0

I have a data set which collected biomass of a species from 7 trees repeatedly. I assumed the biomass would change as a Gaussian peak function through time. Since it's non-linear with nested repeated measure and I would like to add tree group as a random effect, I assume a non-linear mixed effect model should do the job?

Here is the sample data: (can be downloaded from here https://www.dropbox.com/s/i5vm2fasx75shp0/tree.RData?dl=0 )

Here is the code:

>tree
   time id Biomass
1    41 A1     7.6
2    41 A2     0.0
3    41 A3    71.1
4    57 A4    26.9
5    57 A5    52.1
6    57 A6   101.1
7    72 A1     0.0
8    72 A2     0.0
9    72 A3    34.0
10   83 A4    40.9
11   83 A5   195.4
12   83 A6   167.0
13   97 A1    17.6
14   97 A2    12.7
15   97 A3    12.4
16  111 A4   266.5
17  111 A5   139.6
18  111 A6   256.2
19  127 A1   111.4
20  127 A2    35.8
21  127 A3    72.9
22  149 A4   159.5
23  149 A5   305.5
24  149 A6   366.4
25  159 A1    19.5
26  159 A2    57.5
27  161 A3   205.6
28  174 A4   257.3
29  174 A5   166.2
30  175 A6   374.3
31  187 A1   159.3
32  187 A2    54.6
33  187 A3   136.4
34  204 A4   256.1
35  205 A5   423.3
36  204 A6   237.8
37  216 A1    67.4
38  216 A2   205.6
39  216 A3   316.1
40  232 A4   128.5
41  233 A5    20.8
42  233 A6    67.8

fm1<-Biomass~time+rd  
#run model
model<-nlme(fm1, data=tree,
            fixed=time~1, 
            random=rd~1,
            groups=~id,
            start=c(time=43))

#model summary
summary(model)

Is my formula correct? It seemed overly simple that I've been scratching my head to find where it indicated the Gaussian function? Since package nlme was designed to "Fit and compare Gaussian linear and nonlinear mixed-effects models" (as indicated in the package manual), I think variables were assumed to be based on the Gaussian distribution? Plus it did provide sigma estimate:

> model$sigma
[1] 104.1907

Sorry if it looks like a dumb question. This is my first time trying to fit such model. Thanks

lamushidi
  • 303
  • 3
  • 5
  • 14
  • Have you looked at the other worked examples on SO? (The assumption of regression models is not generally for Gaussian distribution of variables but rather of the residuals,) – IRTFM Mar 13 '17 at 05:34
  • What is `rd`? You'll need to specify a non-linear function (possibly `dnorm`?) in the formula. As it is you are fitting a linear model using numeric optimization. – Roland Mar 13 '17 at 08:15
  • Yes, I did look for other examples. However I looked everywhere but didn't see one fitting the fixed effect with a Gaussian distribution. I assume in the R-help instruction for `nlme` indicated it by assuming an asymptotic relationship? `fm1<-Biomass~SSasymp(time, Asym, R0, lrc) model <- nlme(fm1, data = tree, fixed = Asym+R0+lrc~ 1, random = Asym ~ 1, groups = ~id, start = c(Asym = 103, R0 = -8.5, lrc = -3.3), verbose=T)`. I tried it but it didn't work. :( – lamushidi Mar 15 '17 at 05:53
  • The error message was `Error in nlme.formula(fm1, data = tree, fixed = Asym + R0 + lrc ~ 1, random = Asym ~ : Singularity in backsolve at level 0, block 1`. I did think about `dnorm` but had no idea how to put in into my formula. BTW, `rd` was the name of the parameter for random effect. It did give me estimates for all the tree groups. – lamushidi Mar 15 '17 at 05:56
  • Maybe I should code my own function and use `optim` instead? – lamushidi Mar 15 '17 at 06:02

0 Answers0