lmmlasso - how to specify a random intercept, and make a prediction?

时间:2016-04-15 11:02:43

标签: r mixed-models

I'm new to R and statistical modelling, and am looking to use the lmmlasso library in r to fit a mixed effects model, selecting only the best fixed effects out of ~300 possible variables.

For this model I'd like to include both a fixed intercept, a random effect, and a random intercept. Looking at the manual on CRAN, I've come across the following:

x: matrix of dimension ntot x p including the fixed-effects covariables. An intercept has to be included in the first column as (1,...,1).

z: random effects matrix of dimension ntot x q. It has to be a matrix, even if q=1.

While it's obvious what I need to do for the fixed intercept I'm not quite sure how to include both a random intercept and effect. Is it exactly the same as the fixed matrix, where I include (1...1) in my first column?

In addition to this, I'm looking to validate the resulting model I get with another dataset. For lmmlasso is there a function similar to predict in lme4 that can be used to compute new predictions based on the output I get? Alternatively, is it viable/correct to construct a new model using lmer using the variables with non-zero coefficients returned by lmmlasso, and then use predict on the new model?

Thanks in advance.

0 个答案:

没有答案