0

I have been looking forever about how to do this in R and cannot find anything! Basically, I am wanting to shrink predictors using LMM. So I have a set of fixed effects, X, and I have a set of predictors, Z, that I want to put a random effect on so the model is

Y=X*beta+Z*u+e

where u~N(0,sigma_u^2 * I) and e ~ N(0,sigma_e^2 * I). I thought I could do this in lme with

fit <- lme(Y~X,random=pdIdent(~-1+Z))

but I only get the error:

Error in getGroups.data.frame(dataMix, groups) : 
invalid formula for groups

Any help on this issue is much appreciated.

1 Answers1

0

Have you tried:

N = sample size

group <- rep(1, N)
fit <- lme(Y~X, random=list(group=pdIdent(~-1+Z)))
OAV
  • 11
  • 2