[R-sig-ME] Fwd: [Lme4-authors] LME4 and Lmer model

Zhanyou Xu zxuiowa at iastate.edu
Wed Oct 1 02:05:53 CEST 2014


thanks for your quick response.

what we want to do is:
1: to calculate the BLUP for each individual within each group; and
2: to calculate the BLUP across  all groups.

Is there a way to do so just like the BY statement in SAS?

Thanks,

Zhanyou


On Tue, Sep 30, 2014 at 6:47 PM, Ken Beath <ken.beath at mq.edu.au> wrote:
> The BY statement in SAS has nothing to do with BLUP, it simply runs an
> analysis separately for each group defined by BY. The empirical BLUP
> predicts the values of the random effect for each group taking into
> consideration all the data.
>
> There is a command in SAS for extracting the random effect predictions which
> I would hope gives the same results as ranef in R.
>
> Ken
>
> On 30 September 2014 07:19, Zhanyou Xu <zxuiowa at iastate.edu> wrote:
>>
>>  Dear Sir/Madam,
>>
>> We are running lmer to calculate Best Linear Unbiased prediction (BLUP),
>> and we have 10 groups of data, each group has groupID and 42 individual.
>> We want to get BLUP values for each individual material within each
>> group. In SAS, there is a BY statement and we can get BLUP value for
>> each individuals within a group. We are wondering whether there is a
>> similar R code that we can calculate the BLUPs for each group similar
>> like BY statement in SAS? Below is the R code we pare testing for your
>> reference. Thank you very much in advance!
>>
>> Zhanyou
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: Ben Bolker <bbolker at gmail.com>
>> Date: Mon, Sep 29, 2014 at 2:05 PM
>> Subject: Re: [Lme4-authors] LME4 and Lmer model
>> To: zhanyou.xu at syngenta.com,
>> "lme4-authors at lists.r-forge.r-project.org"
>> <lme4-authors at lists.r-forge.r-project.org>,
>> marcia.almeida_de_macedo at syngenta.com, zxuiowa at iastate.edu,
>> lme4-authors at r-forge.wu-wien.ac.at
>>
>>
>> On 14-09-29 11:30 AM, zhanyou.xu at syngenta.com wrote:
>> > Dear Ben and all LME4 authors,
>> >
>> > We are running lmer to calculate Best Linear Unbiased prediction (BLUP),
>> > and we have 10 groups of data, each group has groupID and 42 individual.
>> > We want to get BLUP values for each individual material within each
>> > group. In SAS, there is a BY statement and we can get BLUP value for
>> > each individuals within a group. We are wondering whether there is a
>> > similar R code that we can calculate the BLUPs for each group similar
>> > like by statement in SAS? Below is the R code we pare testing for your
>> > reference. Thank you very much in advance!
>> >
>>
>>
>>     Take a look at ranef() and coef().  If you have further questions,
>> could you please send them to r-sig-mixed-models at r-project.org ?
>>
>>   I can believe that "%in%" works as a nesting indicator, but it is more
>> typical/I am more familiar with REPNO:HOSEID ...  (I'm also curious why
>> you need to ignore the greater-than-1-level check ...)
>>
>>   thanks
>>    Ben Bolker
>>
>>
>> >
>> > Zhanyou
>> >
>> >
>> >
>> >
>> >
>> > Milkvarcomp =  lmer(YGSMN~ (1|ANIMALID) + (1|HOSEID) +
>> > (1|REPNO%in%HOSEID) + (1|MINRNG%in%HOSEID) +
>> >
>> >                 (1|MINROW%in%HOSEID)+
>> > (1|ANIMALID:HOSEID),control=lmerControl(check.nlev.gtr.1="ignore"),
>> > data=Stage3Data)
>> >
>> >
>> > ------------------------------------------------------------------------
>> > /This message may contain confidential information. If you are not the
>> > designated recipient, please notify the sender immediately, and delete
>> > the original and any copies. Any use of the message by you is
>> > prohibited./
>> >
>> >
>> > _______________________________________________
>> > Lme4-authors mailing list
>> > Lme4-authors at lists.r-forge.r-project.org
>> >
>> > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/lme4-authors
>> >
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
>
>
> --
>
> Ken Beath
> Lecturer
> Statistics Department
> MACQUARIE UNIVERSITY NSW 2109, Australia
>
> Phone: +61 (0)2 9850 8516
>
> Building E4A, room 526
> http://stat.mq.edu.au/our_staff/staff_-_alphabetical/staff/beath,_ken/
>
> CRICOS Provider No 00002J
> This message is intended for the addressee named and m...{{dropped:8}}



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