[R] predict nlme syntax

Petr Pikal petr.pikal at precheza.cz
Tue May 10 13:25:09 CEST 2005


Dear all

Please help me with correct syntax of predict.nlme.
I would like to predict from nlme object for new data.
I used predict(fit.nlme6, data=newdata) but I have always got 
fitted values, no matter how I changed newdata.

I have

> summary(fit.nlme6)
Nonlinear mixed-effects model fit by maximum likelihood
  Model: konverze ~ SSfpl(tepl, A, B, xmid, scal) 
 Data: limity.gr 
       AIC      BIC    logLik
  882.4939 907.6738 -433.2469

Random effects:
 Formula: list(xmid ~ 1, scal ~ 1)
 Level: spol.f
 Structure: General positive-definite, Log-Cholesky 
parametrization
         StdDev    Corr 
xmid     29.680114 xmid 
scal      6.481679 0.249
Residual  2.168191      

Fixed effects: list(A ~ 1, B ~ 1, xmid ~ 1, scal ~ 1) 
        Value Std.Error  DF   t-value p-value
A     36.1450  0.837050 154  43.18133       0
B    101.0272  0.432074 154 233.81898       0
xmid 735.3860  8.150964 154  90.22074       0
scal  15.4453  2.201864 154   7.01466       0
 Correlation: 
     A      B      xmid  
B    -0.088              
xmid  0.057 -0.088       
scal -0.089  0.469  0.036

Standardized Within-Group Residuals:
          Min            Q1           Med            Q3           Max 
-3.7707629568 -0.3291628536  0.0005885683  0.4020944158  
3.7911729382 

Number of Observations: 172
Number of Groups: 15 

where **tepl** is independent variable and **spol.f** is grouping 
factor.

The newly constructed data frame newdata has the same structure 
of spol.f levels as has the limity.gr data frame used for fitting.

> levels(limity.gr$spol.f)
 [1] "1.8/3"   "4/3"     "6.3/3"   "10.8/3"  "1.8/7"   "1.8/12"  
"1.8/30"  "6.3/30"  "10.8/30" "1.8/60"  "4/60"    "6.3/60"  
"1.8/110"
[14] "1.8/200" "1.8/300"

> levels(newdata$spol.f)
 [1] "1.8/3"   "4/3"     "6.3/3"   "10.8/3"  "1.8/7"   "1.8/12"  
"1.8/30"  "6.3/30"  "10.8/30" "1.8/60"  "4/60"    "6.3/60"  
"1.8/110"
[14] "1.8/200" "1.8/300"
>

The only difference is in temperature.

Please advice how shall I change newdata to be able to use it in 
predict function.

Thank you.

Best regards

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list