[R] How can I 'predict' from an nls model with a fit specified for separate groups?

From: Stuart Rosen <stuart_at_phonetics.ucl.ac.uk>
Date: Wed, 20 Apr 2011 16:04:31 +0100


Following an example on p 111 in 'Nonlinear Regression with R' by Ritz & Streibig, I have been fitting nls models using square brackets with the grouping variable inside. In their book is this example, in which 'state' is a factor indicating whether a treatment has been used or not:

> Puromycin.m1 <- nls(rate ~ Vm[state] *

+ conc/(K[state] + conc), data = Puromycin,
+ start = list(K = c(0.1, 0.1),
+ Vm = c(200, 200)))

What I cannot figure out is how to specify the value of the grouping variable in a 'predict' statement. In my own example, I can only seem to get the predictions for the 1st specified level of the grouping variable. I promise that I have read the documentation, and have tried a number of things, but cannot get the correct predictions.

Thank you for any help.

Yours - Stuart

-- 
/*------------------------------------------------*/
Stuart Rosen, PhD
Professor of Speech and Hearing Science
UCL Speech, Hearing and Phonetic Sciences

______________________________________________
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 Wed 20 Apr 2011 - 15:54:06 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 Wed 20 Apr 2011 - 17:50:33 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