# [R] NLS plinear question

From: Rick DeShon <deshon_at_msu.edu>
Date: Tue, 06 May 2008 16:50:11 -0400

I've run into a problem with the plinear algorithm in nls that is confusing me.

Assume the following reaction time data over 15 trials for a single unit. Trials are coded from 0-14 so that the intercept represents reaction time in the first trial.

trl RT

``` 0    1132.0
1     630.5
2    1371.5
3     704.0
4     488.5
5     575.5
6     613.0
7     824.5
8     509.0
9     791.0
10     492.5
11     515.5
12     467.0
13     556.5
14     456.0

```

Now fit a power function to this data using nls with the plinear algorithm
>fit.pw <-nls(RT ~ cbind(1,trl, trl^p), start = c(p = -.2), algorithm =
"plinear", data=df.one)

Yields the following error message....
"Error in numericDeriv(form[[3]], names(ind), env) :

Missing value or an infinity produced when evaluating the model"

Now, recode trial from 1-15 and run the same model.
>fit.pw <-nls(RT ~ cbind(1,trl, trl^p), start = c(p = -.2), algorithm =
"plinear", data=df.one)

p .lin1 .lin.trl .lin3    -0.2845 200.3230 -8.9467 904.7582  residual sum-of-squares: 555915

Number of iterations to convergence: 11

Any idea why having a zero for the first value of X causes this problem?

Rick DeShon

[[alternative HTML version deleted]]

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 Tue 06 May 2008 - 20:53:22 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 Tue 06 May 2008 - 22:30:35 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.