Smooth constructors and optimizer for Lasso penalization with bamlss
. The
penalization is based on a Taylor series approximation of the Lasso penalty.
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  ## Smooth constructor function.
la(formula, type = c("single", "multiple"), ...)
## Single Lasso smoothing parameter optimizer.
lasso(x, y, start = NULL, adaptive = TRUE, lower = 0.001, upper = 1000,
nlambda = 100, lambda = NULL, verbose = TRUE, digits = 4,
flush = TRUE, nu = NULL, stop.nu = NULL,
ridge = .Machine$double.eps^0.25, zeromodel = NULL, ...)
## Lasso transformation function to set
## adaptive weights from an unpenalized model.
lasso.transform(x, zeromodel, nobs = NULL, ...)
## Plotting function for lasso() optimizer.
lasso.plot(x, which = c("criterion", "parameters"),
spar = TRUE, name = NULL, mstop = NULL, retrans = FALSE,
color = NULL, show.lambda = TRUE, labels = NULL,
digits = 2, ...)
## Extract optimum stopping iteration for lasso() optimizer.
## Based on the minimum of the information criterion.
lasso.stop(x)
## Extract retransformed Lasso coefficients.
lasso.coef(x, ...)

formula 
A formula like 
type 
Should one single penalty parameter be used or multiple parameters, one for each
covariate in 
x 
For function 
y 
The model response, as returned from function 
start 
A vector of starting values. Note, Lasso smoothing parameters will be dropped. 
adaptive 
Should adaptive weights be used for fused Lasso terms? 
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

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 
flush 
use 
nu 
Numeric or logical. Defines the step length for parameter updating of a model term,
useful when the algorithm encounters convergence problems. If 
stop.nu 
Integer. Should step length reduction be stopped after 
ridge 
A ridge penalty parameter that should be used when finding adaptive weights, i.e., parameters from an unpenalized model. The ridge penalty is used to stabilize the estimation in complex models. 
zeromodel 
A model containing the unpenalized parameters, e.g., for each 
nobs 
Integer, number of observations of the data used for modeling. If not supplied

which 
Which of the two provided plots should be created, character or integer 
spar 
Should graphical parameters be set by the plotting function? 
name 
Character, the name of the coefficient group that should be plotted. Note that
the string provided in 
mstop 
Integer vector, defines the path length to be plotted. 
retrans 
Logical, should coefficients be retransformed before plotting? 
color 
Colors or color function that creates colors for the group paths. 
show.lambda 
Logical. Should the optimum value of the penalty parameter lambda be shown? 
labels 
A character string of labels that should be used on the 4 axis. 
... 
Arguments passed to the subsequent smooth constructor function.

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 loglikelihood, logposterior and the information criterion for each lambda. 
Oelker MargrethRuth 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/s116340150205y
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 48  ## Not run: ## Simulated fusion Lasso example.
bmu < c(0,0,0,2,2,2,4,4,4)
bsigma < c(0,0,0,2,2,2,1,1,1)
id < factor(sort(rep(1:length(bmu), length.out = 300)))
## Response.
set.seed(123)
y < bmu[id] + rnorm(length(id), sd = exp(bsigma[id]))
## Estimate model:
## fuse=1 > nominal fusion,
## fuse=2 > ordinal fusion,
## first, unpenalized model to be used for adaptive fusion weights.
f < list(y ~ la(id,fuse=2,fx=TRUE), sigma ~ la(id,fuse=1,fx=TRUE))
b0 < bamlss(f, sampler = FALSE)
## Model with single lambda parameter.
f < list(y ~ la(id,fuse=2), sigma ~ la(id,fuse=1))
b1 < bamlss(f, sampler = FALSE, optimizer = lasso,
criterion = "BIC", zeromodel = b0)
## Plot information criterion and coefficient paths.
lasso.plot(b1, which = 1)
lasso.plot(b1, which = 2)
lasso.plot(b1, which = 2, name = "mu.s.la(id).id")
lasso.plot(b1, which = 2, name = "sigma.s.la(id).id")
## Extract coefficients for optimum Lasso parameter.
coef(b1, mstop = lasso.stop(b1))
## Predict with optimum Lasso parameter.
p1 < predict(b1, mstop = lasso.stop(b1))
## Full MCMC, needs lasso.transform() to assign the
## adaptive weights from unpenalized model b0.
b2 < bamlss(f, optimizer = FALSE, transform = lasso.transform,
zeromodel = b0, nobs = length(y), start = coef(b1, mstop = lasso.stop(b1)))
summary(b2)
plot(b2)
ci < confint(b2, model = "mu", pterms = FALSE, sterms = TRUE)
lasso.plot(b1, which = 2, name = "mu.s.la(id).id", spar = FALSE)
for(i in 1:8) {
abline(h = ci[i, 1], lty = 2, col = "red")
abline(h = ci[i, 2], lty = 2, col = "red")
}
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.