[R] NLS plinear question

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue May 6 23:22:10 CEST 2008


0^(-0.2) = Inf, so you started with an infinite prediction for your first 
point and hence an infinite sum of squares.

On Tue, 6 May 2008, Rick DeShon wrote:

> Hi All.
>
> 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)
>
> Seems to work fine now...
> Nonlinear regression model
>  model:  RT ~ cbind(1, trl, trl^p)
>   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?
>
> Thanks in advance,
>
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list