Lasso Smooth Constructor

Share:

Description

Smooth constructors and optimizer for Lasso penalization with bamlss. The penalization is based on a Taylor series approximation of the Lasso penalty.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Smooth constructor function.
la(formula, type = c("single", "multiple"), ...)

## Single Lasso smoothing parameter optimizer.
lasso(x, y, start = NULL, lower = 0.001, upper = 1000,
  nlambda = 100, lambda = NULL, verbose = TRUE, digits = 4,
  flush = TRUE, ...)

## Plotting function for lasso() optimizer.
lasso.plot(x, which = c("criterion", "parameters"), spar = TRUE, ...)

## Extract optimum stopping iteration for lasso() optimizer.
## Based on the minimum of the information criterion.
lasso.stop(x)

Arguments

formula

A formula like ~ x1 + x2 + ... + xk of variables which should be penalized with Lasso.

type

Should one single penalty parameter be used or multiple parameters, one for each covariate in formula.

x

For function lasso() the x list, as returned from function bamlss.frame, holding all model matrices and other information that is used for fitting the model. For the plotting function and lasso.stop() the corresponding bamlss object fitted with the lasso() optimizer.

y

The model response, as returned from function bamlss.frame.

start

A vector of starting values. Note, Lasso smoothing parameters will be dropped.

lower

Numeric. The minimum lambda value.

upper

Numeric. The maximum lambda value.

nlambda

Integer. The number of smoothing parameters for which coefficients should be estimated, i.e., the vector of smoothing parameters is build up as a sequence from lower to upper with length nlambda.

lambda

Numeric. A sequence/vector of lambda parameters that should be used.

verbose

Print information during runtime of the algorithm.

digits

Set the digits for printing when verbose = TRUE.

flush

use flush.console for displaying the current output in the console.

which

Which of the two provided plots should be created?

spar

Should graphical parameters be set by the plotting function?

...

Arguments passed to the subsequent smooth constructor function. lambda controls the starting value of the penalty parameter, const the constant that is added within the penalty approximation. For the optimizer lasso() arguments passed to function bfit.

Value

For function la(), similar to function s a simple smooth specification object.

For function lasso() a list containing the following objects:

fitted.values

A named list of the fitted values based on the last lasso iteration of the modeled parameters of the selected distribution.

parameters

A matrix, each row corresponds to the parameter values of one boosting iteration.

lasso.stats

A matrix containing information about the log-likelihood, log-posterior and the information criterion for each lambda.

References

Oelker Margreth-Ruth and Tutz Gerhard (2015). A uniform framework for combination of penalties in generalized structured models. Adv Data Anal Classif. http://dx.doi.org/10.1007/s11634-015-0205-y

See Also

s, smooth.construct

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
## Not run: ## Load data example.
data(rent99, package = "gamlss.data")
rent99$district <- as.factor(rent99$district)

## Model formula.
fl <- ~ area + yearc + location + bath + kitchen + cheating + district
f <- list(rentsqm ~ la(fl), sigma ~ la(fl))

## Estimate Lasso model with
## single lambda parameter.
b1 <- bamlss(f, data = rent99, sampler = FALSE, optimizer = lasso,
  lower = 0.01, upper = 10, criterion = "BIC", nlambda = 400)

## Plot information criterion and
## coefficient paths.
lasso.plot(b1)

## Extract optimum lambda/iteration.
lasso.stop(b1)

## Extract coefficients for optimum
## Lasso parameter.
parameters(b1, mstop = lasso.stop(b1))

## Predict with optimum lasso.
p1 <- predict(b1, mstop = lasso.stop(b1))

## Now with different lambda for mu and sigma using
## optimizer function bfit().
b2 <- bamlss(f, data = rent99, criterion = "BIC", sampler = FALSE)
summary(b2)

## With lambda parameters for each covariate.
f <- list(
  rentsqm ~ la(area) + la(yearc) + la(location) +
    la(bath) + la(kitchen) + la(cheating) + la(district),
  sigma ~ la(area) + la(yearc) + la(location) +
    la(bath) + la(kitchen) + la(cheating) + la(district)
)
b3 <- bamlss(f, data = rent99, criterion = "BIC", sampler = FALSE)
summary(b3)

## With full MCMC.
b4 <- bamlss(f, data = rent99, criterion = "BIC")
summary(b4)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.