[S] nls question (fwd)

Timothy Johnson (tjohnson@s.psych.uiuc.edu)
Wed, 4 Mar 1998 12:57:01 -0600 (CST)


Never mind, I forgot to attach my data. Ugh.

Tim

> I'm having some problem using deriv3 with nls. What I am trying to do
> is almost exactly like the example in section 9.5 of V&R (2nd ed.).
> Here is my code:
>
> my.panel <- function(x,y) {
>
> expn3 <- deriv3(~ b0 - b1 * exp(-b2*x^b3),
> c("b0","b1","b2","b3"),
> function(x,b0,b1,b2,b3) {})
> param <- nls(y ~ expn3(x,b0,b1,b2,b3), start = c(b0 = 1, b1 =
> 1, b2 = 1, b3 = 1),
> data = data.frame(x = x, y = y))$parameters
> x.temp <- seq(min(x), max(x), length = 40)
> y.temp <- param[1] - param[2] * exp(-param[3]*x.temp^param[4])
> lines(x.temp, y.temp)
> }
>
> xyplot(cpdiff~groupsize | sim, data = csim,panel = function(x,y,...)
> {panel.xyplot(x,y,cex=.60); my.panel(x,y)},
> strip=function(...) strip.default(...,strip.name=c(T,T)))
>
> The error I get is this:
>
> Error in nls(y ~ expn3(x, b0, b1, b2, b3), start = c(b0 =..: couldn't
> find function "expn3"
> Dumped
>
> Any ideas? I'm running version 4.0 on Windows95.
>
> Thanks in advance.
>
> Tim
>

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news