[R-sig-ME] Extracting model matrices used by lmer

Ben Bolker bbolker at gmail.com
Fri Nov 16 05:04:34 CET 2012


Asaf Weinstein <asafw.at.wharton at ...> writes:

> 
> Hello again,
> 
> Is there an easy way of obtaining the X and Z model matrices in
> 
> *y = X*Beta + Z*u + eps*
> 
> with the lmer function? I am trying to extract these because I want to
> obtain maximum likelihood estimates for the case where sigma sq (error
> variance) is known.


See

?getME

As shown in the examples:

   (nmME <- eval(formals(getME)$name))
 [1] "X"       "Z"       "Zt"      "u"       "Gp"      "L"       "Lambda" 
 [8] "Lambdat" "A"       "flist"   "RX"      "RZX"     "beta"    "theta"  
[15] "REML"    "n_rtrms" "is_REML"


so getME(model,"X") and getME(model,"Z") should do what you want.



More information about the R-sig-mixed-models mailing list