solve_univariate: Solve unidirectional constrained problem

Description Usage Arguments Details Value Examples

View source: R/optim_shooting.R

Description

This function minimizes β in the 1D problem 1/2 * ||y - x β||_2^2 + λ |β| subject to either β <= 0 or u + vβ <= 0 (coordinate wise).

Usage

 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"),
  ...
)

Arguments

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 constraint_type = "beta") or u + vβ (for constraint_type = "yhat") are negative.

...

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 constraint_type is set to "yhat".

prob

A vector of probability weights for obtaining the coordinates to be sampled.

max_it

Maximum number of iterations.

Details

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)

Value

The scalar solution β of the 1D optimization problem

the estimated value of beta

Examples

1
solve_univariate(1:4, -(4:1), 2)

abichat/zazou documentation built on Sept. 8, 2021, 6:53 a.m.