splmm {splmm} | R Documentation |
Function to fit linear mixed-effects model with double penalty for fixed effects and random effects
Description
All the details of the algorithm can be found in the manuscript.
Usage
splmm(x, y, z, grp, lam1, lam2, nonpen.b=1,nonpen.L=1,penalty.b=c("lasso","scad"),
penalty.L=c("lasso","scad"),CovOpt=c("nlminb","optimize"),
standardize=TRUE,control=splmmControl())
## Default S3 method:
splmm(x, y, z, grp, lam1, lam2, nonpen.b=1,nonpen.L=1,penalty.b=c("lasso","scad"),
penalty.L=c("lasso","scad"),CovOpt=c("nlminb","optimize"),
standardize=TRUE,control=splmmControl())
Arguments
x |
matrix of dimension N x p including the fixed-effects covariables. An intercept has to be included in the first column as (1,...,1). |
y |
response variable of length N. |
z |
random effects matrix of dimension N x q. It has to be a matrix, even if q=1. |
grp |
grouping variable of length N |
lam1 |
regularization parameter for fixed effects penalization. |
lam2 |
regularization parameter for random effects penalization. |
nonpen.b |
Index of indices of fixed effects not penalized. The default value is 1, which means the fixed intercept is not penalized |
nonpen.L |
Index of indices of random effects not penalized. The default value is 1, which means the random intercept is not penalized |
penalty.b |
The penalty method for fixed effects penalization. Currently available options include LASSO penalty and SCAD penalty. |
penalty.L |
The penalty method for fixed effects penalization. Currently available options include LASSO penalty and SCAD penalty. |
CovOpt |
which optimization routine should be used for updating the variance parameter. The available options include optimize and nlminb. nlminb uses the estimate of the last iteration as a starting value. nlminb is faster if there are many Gauss-Seidel iterations. |
standardize |
A logical parameter specifying whether the fixed effects matrix x and random effects matrix z should be standardized such that each column has mean 0 and standard deviation 1. The default value is |
control |
control parameters for the algorithm and the Armijo Rule, see |
Value
A 'splmm'
object is returned, for which
coef
,resid
, fitted
,
print
, summary
methods exist.
data |
data set used for fitting the model, as a list with four components: x, y, z, grp (see above) |
coefInit |
list of the starting values for beta, random effects covariance structure, and variance structure |
penalty.b |
The penalty method for fixed effects penalization. |
penalty.L |
The penalty method for random effects penalization. |
nonpen.b |
Index of indices of fixed effects not penalized. |
nonpen.L |
Index of indices of random effects not penalized. |
lambda1 |
regularization parameter for fixed effects penalization scaled by the number of subjects. |
lambda2 |
regularization parameter for random effects penalization the number of subjects. |
sigma |
standard deviation |
D |
The estimates of the random effects covariance matrix |
Lvec |
Vectorized |
coefficients |
estimated fixed-effects coefficients |
random |
vector with random effects, sorted by groups |
ranef |
vector with random effects, sorted by effect |
u |
vector with the standardized random effects, sorted by effect |
fixef |
estimated fixed-effects coeffidients |
fitted.values |
The fitted values |
residuals |
raw residuals |
corD |
Correlation matrix of the random effects |
logLik |
value of the log-likelihood function |
deviance |
deviance=-2*logLik |
npar |
Number of parameters. Corresponds to the cardinality
of the set of nonzero |
aic |
AIC |
bic |
BIC |
bicc |
Modified BIC defined by Wang et al (2009) |
ebic |
Extended BIC defined by Chen and Chen (2008) |
converged |
Does the algorithm converge? 0: correct convergence ;
an odd number means that maxIter was reached ; an even number means
that the Armijo step was not succesful. For each unsuccessfull Armijo
step, 2 is added to converged. If converged is large compared to the
number of iterations |
counter |
The number of iterations used. |
stopped |
logical indicating whether the algorithm stopped due to too many parameters, if yes need to increase |
CovOpt |
optimization routine |
control |
see |
objective |
Value of the objective function at the final estimates |
call |
call |
Examples
### Use splmm for a toy dataset.
data(simulated_data)
set.seed(144)
fit = splmm(x=simulated_data$x,y=simulated_data$y,
z=simulated_data$z,grp=simulated_data$grp,
lam1=0.1,lam2=0.01, penalty.b="scad", penalty.L="scad")
summary(fit)
## Use splmm on the Kenya school cognitive data set
data(cognitive)
x <- model.matrix(ravens ~schoolid+treatment+year+sex+age_at_time0
+height+weight+head_circ+ses+mom_read+mom_write
+mom_edu, cognitive)
z <- x
fit <- splmm(x=x,y=cognitive$ravens,z=z,grp=cognitive$id,lam1=0.1,
lam2=0.1,penalty.b="lasso", penalty.L="lasso")
summary(fit)