[R-sig-ME] Simulating linear mixed models - the Venables approach

Hank Stevens HStevens at MUOhio.edu
Wed Apr 9 18:47:30 CEST 2008


Hi Doug,
I couldn't find this email on the r-help list. Would you mind  
elaborating **briefly** on what is elegant about this?
Eager to learn,
Hank
On Apr 7, 2008, at 12:29 PM, Douglas Bates wrote:

> In case you missed it on the R-help list, I urge readers of this list
> to consider the understated elegance of the code Bill Venables posted
> for simulating data from a simple random effects model.
>
>> set.seed(7658943)
>>
>> fph <- 0.4
>> Sigh <- sqrt(0.0002)
>> Sigi <- sqrt(0.04)
>>
>> reH <- rnorm(90, fph, Sigh)  ## hospid effects
>> dta <- within(expand.grid(hospid = 1:90, empid = 1:80),
>           fpi1 <- reH[hospid] + rnorm(7200, fph, Sigi))
>
> One is reminded of John Keats
>
> 'Beauty is truth, truth beauty,—that is all
> Ye know on earth, and all ye need to know.'
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



Dr. Hank Stevens, Associate Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/~stevenmh/
http://www.cas.muohio.edu/ecology
http://www.muohio.edu/botany/

"If the stars should appear one night in a thousand years, how would men
believe and adore." -Ralph Waldo Emerson, writer and philosopher  
(1803-1882)




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