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

Ben Bolker bbolker at gmail.com
Tue Feb 26 23:20:28 CET 2013


On 13-02-26 10:52 AM, Asaf Weinstein wrote:
> Thank you very much, Ben, for your useful answer from long ago.
> I still can't figure out a way to extract the Residual variance (sigma^2)
> estimate using getME()?
> 
> Thanks again,
> Asaf

  I think sigma(model)^2 should do it -- apparently works for stable as
well as development lme4.

> 
> 
> On 15 November 2012 23:04, Ben Bolker <bbolker at gmail.com> wrote:
> 
>> 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.
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>



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