# load data set
data(GLESsmall)
# define response and covariate matrix
X <- scale(GLESsmall[, 11:14])
Y <- as.matrix(GLESsmall[, 1:10])
# vector of subtitles, containing the coding of the single covariates
subs <- c("(in years)","female (1); male (0)",
"East Germany (1); West Germany (0)","(very) good (1); else (0)")
# vector of tuning parameters
lambda <- exp(seq(log(31),log(1),length=50))-1
# compute BTLLasso model
m <- BTLLasso(Y = Y, X = X, lambda = lambda)
op <- par(no.readonly = TRUE)
par(mar=c(5,4,4,8))
# plot parameter paths
singlepaths(m, subs = subs)
# compute 10-fold cross-validation
set.seed(5)
m.cv <- cv.BTLLasso(Y = Y, X = X, folds = 10, lambda = lambda, cores = 10)
# plot parameter paths, together with cv-optimal model
singlepaths(m.cv, subs = subs)
par(op)Run the code above in your browser using DataLab