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