Description Usage Arguments Details Value Examples
View source: R/optim_shooting.R
This function minimizes β in the 1D problem 1/2 * ||y - x β||_2^2 + λ |β| subject to either β <= 0 or u + vβ <= 0 (coordinate wise).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  | solve_univariate(
  y,
  x,
  u,
  v,
  lambda = 0,
  constraint_type = c("beta", "yhat", "none"),
  ...
)
solve_multivariate(
  y,
  X,
  lambda,
  beta0,
  mat_incidence,
  prob = NULL,
  max_it = 500,
  constraint_type = c("beta", "yhat", "none"),
  ...
)
 | 
y | 
 a vector of size n.  | 
x | 
 a vector of size n.  | 
u | 
 a vector of size n.  | 
v | 
 a vector of size n. Column of the incidence matrix.  | 
lambda | 
 a grid of positive regularization parameters  | 
constraint_type | 
 Character. "beta" (default), "yhat" or "none".
Ensures that all coordinates of β
(for   | 
... | 
 Further arguments passed to or from other methods.  | 
X | 
 A matrix of size x p.  | 
beta0 | 
 The initial position of beta.  | 
mat_incidence | 
 Incidence matrix from the problem. Used only if
  | 
prob | 
 A vector of probability weights for obtaining the coordinates to be sampled.  | 
max_it | 
 Maximum number of iterations.  | 
The analytical solution of this problem is given by
β* = min(0, (y'x + λ) / x'x ).
when using the first constraint and is slightly more complex when using the second constraint (refer to the corresponding vignette)
The scalar solution β of the 1D optimization problem
the estimated value of beta
1  | solve_univariate(1:4, -(4:1), 2)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.