# [R-sig-ME] Non-linear mixed model

Juan Pablo Edwards Molina edwardsmolina at gmail.com
Thu Sep 14 14:57:39 CEST 2017

```Dear list members,

I´m trying to test the effect of the climate region classification on
the in vitro growth of a sample (n =20) of fungus races.  I grew them
in several temperatures (20, 22, 25, 28, 31) that I knew they could
have the maximum growth:

race state   Clima1  Kopp Kopp2   temp   rep    diam
1      TO       F          Aw             B     20        1     4.4
1      TO       F          Aw             B     20        2     4.1
1      TO       F          Aw             B     20        3     4.3
1      TO       F          Aw             B     22        1     4.8
1      TO       F          Aw             B     22        2     4.5
1      TO       F          Aw             B     22        3     4.4
..

The approach that I´m considering is to fitt a non- linear model:

diam ~ thy * exp (thq*(temp-thx)² + thc*(temp-thx)³)

# thx: Optimum temperature
# thy: Diameter at optimum
# thq: Curvature
# thc: Skewness

Since I have particular interest on "thx": How should I include the
effect of my climate classiification variables on that coefficient?

This is my try in nlme:

df <- groupedData(diam~temp|race, data=d, order=FALSE)

n1 <- nlme(diam ~ thy * exp(thq * (temp - thx)^2 + thc * (temp - thx)^3),
fixed = thy + thq + thx + thc ~ 1,
random = thy + thq + thx + thc ~ 1 | race,
start = c(thy = 5.5, thq = -0.08, thx = 25, thc = -0.01),
data = df)

The overall model converged and this is the summary:

======================================================
Nonlinear mixed-effects model fit by maximum likelihood
Model: diam ~ thy * exp(thq * (temp - thx)^2 + thc * (temp - thx)^3)
Data: df
AIC      BIC    logLik
619.2972 652.1712 -301.6486

Random effects:
Formula: list(thy ~ 1, thx ~ 1)
Level: race

Structure: General positive-definite, Log-Cholesky parametrization
StdDev        Corr
thy      0.00002186836 thy
thx      0.00001466761 0
Residual 0.47302438540

Fixed effects: thy + thq + thx + thc ~ 1
Value        Std.Error         DF   t-value        p-value
thy   5.456386   0.03598277  427   151.63885  0.0000
thq  -0.011081   0.00043084  427   -25.71992  0.0000
thx  25.908119  0.17218070  427   150.47052  0.0000
thc   0.000458   0.00015103  427     3.03271    0.0026
Correlation:
thy    thq    thx
thq -0.567
thx  0.217  0.289
thc -0.231 -0.192 -0.924

Standardized Within-Group Residuals:
Min          Q1         Med          Q3         Max
-3.53487665 -0.64456754  0.06126737  0.67103195  2.17757223

Number of Observations: 450
Number of Groups: 20

=========================================================

Thanks in advance... Any help would be very helpful!

J. Edwards

```