[R] help with syntax of random formula

From: Thomas Wutzler <thomas.wutzler_at_web.de>
Date: Fri, 07 Nov 2008 19:59:58 +0100

Dear R-users

Thanks to Jose Pinheiro, Douglas Bates and coworkes for providing R with the nlme package.

Could someone help me, please, to specify a correct random formula for a mixed model, that specifies no random effect on a higher level?

I have the following dataset of timeseries of respiration measurements (column resp) of biomass including a parameter initial biomass x0. Respiration measurements have been recorded in several experiments, each consisting of several replicates.

'data.frame': 3229 obs. of 5 variables:
$ suite : Factor w/ 3 levels "Face","Fal","Pushchino": 1 1 1 1 1 1
1 1 1 1 ...
$ experiment: Factor w/ 44 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1
1 ...
$ replicate : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 1 1 1 1 ...
$ time : num 1.84 2.84 3.84 4.84 5.84 ...
$ resp : num 4.09 3.94 3.70 3.88 4.03 ...

rd <-
groupedData( resp ~ time | experiment/replicate, data=rd)

Time is the first level at the same level as the dependent variable resp, replicate is the second level, experiment the third. (In future suite will be used as another level. For simplicity here, I first try with data of only one suite)

I want to fit a mixed model to the data which includes random effects on the replicate level but no random effects on the experiment level. The random effects should have a distribution around 0 within each experiment.

I succeded to include random effects on both levels. random=list( experiment=x0~1, replicate=x0~1 )

I succeded also to fit a model to only replicate level: # replicate 1 in experiment i has nothing to do with replicate 1 in other experiment
rd$exprep <- paste( rd$experiment, rd$replicate, sep="_") random=list( exprep=x0~1 )

However, this gives a single distribution across all replicates of all experiments.
Instead, I want to have a distribution of random effects across only replicates of an experiment with mean zero for each experiment

I tried amongst others the following syntax without success:

random=list( experiment=~1, exprep=x0~1 )
random=list( experiment=1~1, exprep=x0~1 )
random=list( experiment=NULL, exprep=x0~1 )

I am using nlme version 3.1-86 on R 2.6.1 on Windows XP.

Is it possible to fit such a model with nlme? What is the correct syntax?
Do I need the exprep- variable or is it clear with the grouping that replicate=1 in experiment=1 is different from replicate=1 in other experiments!=1?

Best regards
Thomas Wutzler

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 07 Nov 2008 - 19:51:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 07 Nov 2008 - 20:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive