Message-ID: <4DAEF5FF.5000507@phon.ucl.ac.uk>
Date: 2011-04-20T15:04:31Z
From: Stuart Rosen
Subject: How can I 'predict' from an nls model with a fit specified for separate groups?
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