Skip to contents

Fits an LPL-TF estimator with a fixed operator: $$\hat f = \arg\min_f \frac12\|y-f\|_2^2 + \lambda\|A_{\mathrm{LPL}}f\|_1.$$

Usage

fit.lpl.tf(
  X = NULL,
  y,
  operator = NULL,
  adj.list = NULL,
  weight.list = NULL,
  graph = NULL,
  degree = 2L,
  lambda.grid = NULL,
  lambda = NULL,
  lambda.selection = c("cv", "fixed"),
  operator.grid = NULL,
  foldid = NULL,
  cv.folds = 5L,
  cv.loss = c("mse", "rmse", "mae"),
  cv.seed = NULL,
  cv.repeats = 1L,
  solver = c("genlasso"),
  selection = c("min", "one.se"),
  n.lambda = 80L,
  maxsteps = 2000L,
  minlam = 0,
  approx = FALSE,
  rtol = 1e-07,
  btol = 1e-07,
  eps = 1e-04,
  verbose = FALSE,
  ...
)

Arguments

X

Optional coordinate matrix used to build lpl.tf.operator when operator is NULL.

y

Numeric response vector.

operator

Optional "lpl_tf_operator" object.

adj.list, weight.list, graph

Optional graph inputs passed to lpl.tf.operator when operator is NULL.

degree

Polynomial degree passed to lpl.tf.operator when operator is NULL.

lambda.grid

Optional nonnegative lambda grid.

lambda

Optional fixed lambda shortcut. If supplied, it is used as the single fixed lambda and lambda.selection must be "fixed".

lambda.selection

"cv" or "fixed". CV requires an explicit lambda.grid so the candidate grid is not generated from the full response vector before fold scoring.

operator.grid

Optional operator candidate grid. Supply a data frame with one row per candidate or a list of named lists. Candidate fields may include operator-construction arguments such as degree, support.type, support.size, min.support, support.buffer, kernel, row.normalize, and local.solver.

foldid

Optional deterministic fold assignments for CV.

cv.folds

Number of generated folds when foldid = NULL.

cv.loss

Cross-validation loss, "mse", "rmse", or "mae". "rmse" uses the same lambda ordering as MSE and reports square-rooted fold errors.

cv.seed

Reserved for reproducible generated folds. Generated folds are deterministic even when this is NULL.

cv.repeats

Number of CV repeats. The current implementation supports only one repeat.

solver

Solver backend. The current implementation supports only "genlasso".

selection

Lambda selection rule, "min" or "one.se".

n.lambda

Number of generated lambdas when a genlasso path is used and lambda.grid = NULL.

maxsteps, minlam, approx, rtol, btol, eps

Genlasso controls.

verbose

Logical.

...

Additional arguments passed to lpl.tf.operator when the operator is built internally.

Value

A list of class "lpl_tf".

Examples

if (requireNamespace("genlasso", quietly = TRUE)) {
  X <- matrix(seq(0, 1, length.out = 18), ncol = 1)
  fit.lpl.tf(X, sin(2 * pi * X[, 1]), degree = 1L,
             support.type = "knn", support.size = 7L,
             lambda = 0.1, lambda.selection = "fixed")
}
#> Local polynomial lifting trend filtering 
#>   Training rows: 18 ; evaluation rows: 18 ; responses: 1 
#>   Observed responses: 18 ; nonfinite fitted entries: 0 
#>   Output: finite output 
#>   Convergence: unavailable (no stored stopping certificate) 
#>   Selected: lambda=0.1 
#>   Prediction scope: stored training vertices only