Computes matrix whose each row is equal to w[i] ⋅ (X[i, :] ⊗ [1, (z - z0), ..., (z-z0)^q]) where q is the degree of the polynomial.

The output matrix is preallocated.


Helper function that finds an initial estimate for σ that is needed for Lasso and ScaledLasso procedures.

The procedure works as follows:

  • s input variables that are most correlated with the response y are found
  • y is regressed on those s features
  • σ is estimated based on the residuals, which gives an upper bound on the true sigma


  • f is CoordinateDifferentiableFunction
  • g is a prox function

This function does two things:

  • It finds h such that f(x + ek⋅h) + g(xk + h) decreses f(x) + g(x). Often h = argmin f(x + ek⋅h) + g(x_k + h), but it could also minimize a local quadratic approximation.

  • The function also updates its internals. This is done by expecting that the algorithm to call this function again is coordinate descent. In future, we may want to implement other variants of coordinate descent.


For a given z0 finds two closest points in zgrid and corresponding values of beta. The output is obtained by interpolating the beta values.