Hi I am trying perform a variable selection using the lasso approach, but my model includes a random effect.
I have run the model without the random effect using both the cv.glmnet and optL1 functions in glmnet and penalized (and got results); however, when I try to run the model with the random effect using glmmLasso I get NAs for much of the output.
Here is a sample of what my data looks like. I have standardized all the predictor variable (x1-x5). The random factor is plot (there are two observations per plot)
head(data)
Plot y x1 x2 x3 x4 x5
[1,] 1 33.38637 -0.3778876 -0.6493490 -1.9874184 0.13397776 -0.70846326
[2,] 4 26.75993 -1.9377779 -0.6932049 0.6747408 1.28276574 0.04818805
[3,] 5 29.25769 -0.1512598 0.7053084 1.0550493 -0.66133701 -0.72988495
[4,] 6 26.47273 -0.3711473 1.5288232 0.2944324 -0.83807362 -0.58073941
[5,] 6 24.32503 -0.9079206 -1.0732886 0.6747408 0.04560945 2.48661737
[6,] 7 32.93299 -0.7321292 0.1546743 -0.0858761 -0.13112716 -0.50712361
Here is the model I ran:
mod<-glmmLasso(y~x1+x2+x3+x4+x5, rnd=list(Plot=~1), data=data,lambda=10)
And the output:
summary(x)
Call:
glmmLasso(fix = y~ x1+x2+X3+X4+x5, rnd = list(Plot = ~1), data = data, lambda = 10)
Fixed Effects:
Coefficients:
Estimate StdErr z.value p.value
(Intercept) 53.4562879 NA NA NA
x1 -32.2591971 NA NA NA
x2 -0.7791392 NA NA NA
x3 -0.0023207 NA NA NA
x4 -0.0148370 NA NA NA
x5 -0.1593585 NA NA NA
Random Effects:
StdDev:
Plot
Plot 3.294686
I originally thought it was not working due to correlations between the predictor variables based on this: Getting p-values for all included parameters using glmmLasso
But when looking at correlations, nothing is too high. I even tried removing x2 as it had the highest correlations but I still got NAs in the model output.
x1 x2 x3 x4 x5
x1 1.00000000 0.1632633 -0.08125663 -0.15017421 0.11155284
x2 0.16326326 1.0000000 -0.31222700 0.30135509 0.14519762
x3 -0.08125663 -0.3122270 1.00000000 -0.09517447 -0.05023544
x4 -0.15017421 0.3013551 -0.09517447 1.00000000 0.19224986
x5 0.11155284 0.1451976 -0.05023544 0.19224986 1.00000000
I am wondering why I am getting NAs. Is it due to my sample size (either only 2 observations per random effect grouping or only having a total of 31 observations?) Any thoughts would be appreciated. Thanks!