[R] Assessing the fit of a nonlinear model to a new dataset

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Apr 5 16:06:43 CEST 2013


On 05/04/2013 14:26, Adams, Jean wrote:
> Rebecca,
>
> I'm not sure why you are interested in the t-statistics and p-values for
> the iterations, but you could perhaps save the nls() fit after 1, 2, 3, ...
> iterations using the argument nls.control(maxiter = n).

But those statistics are only even approximately valid at a local 
minimum of the least-squares surface, that is a converged fit.

>
> Jean
>
>
> On Fri, Apr 5, 2013 at 12:06 AM, Rebecca Lester <
> rebecca.lester at deakin.edu.au> wrote:
>
>> Hi all,
>>
>> I am attempting to apply a nonlinear model developed using nls to a new
>> dataset and assess the fit of that model. At the moment, I am using the
>> fitted model from my fit dataset as the starting point for an nls fit for
>> my test dataset (see below).  I would like to be able to view the
>> t-statistic and p-values for each of the iterations using the trace
>> function, but have not yet worked out how to do this.  Any other
>> suggestions are also welcome.
>>
>> Many thanks,
>>
>> Rebecca
>>
>>> model.wa <- nls(y ~ A*(x^B), start=list(A=107614,B=-0.415)) # create
>> nls() power model for WA data
>>> summary(model.wa) # model summary
>>
>> Formula: y ~ A * (x^B)
>>
>> Parameters:
>>      Estimate Std. Error t value Pr(>|t|)
>> A  7.644e+04  1.240e+04   6.165 4.08e-06 ***
>> B -3.111e-01  4.618e-02  -6.736 1.15e-06 ***
>> ---
>> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>>
>> Residual standard error: 5605 on 21 degrees of freedom
>>
>> Number of iterations to convergence: 6
>> Achieved convergence tolerance: 7.184e-06
>>    (6 observations deleted due to missingness)
>>
>>
>>> model.vic <- nls(y.vic ~ A*(x.vic^B), start = list(A = 7.644e+04, B =
>> -3.111e-01), trace = T)
>> 3430193778 :  76440.0000    -0.3111
>> 2634092902 :  48251.9235397    -0.2552481
>> 2614516166 :  27912.1921354    -0.1772322
>> 2521588892 :  32718.3764594    -0.1862611
>> 2521233646 :  32476.4536126    -0.1836836
>> 2521230904 :  32553.0767231    -0.1841362
>> 2521230824 :  32540.063480    -0.184059
>> 2521230822 :  32542.2970040    -0.1840721
>>
>>
>>
>>
>> Important Notice: The contents of this email are intended solely for the
>> named addressee and are confidential; any unauthorised use, reproduction or
>> storage of the contents is expressly prohibited. If you have received this
>> email in error, please delete it and any attachments immediately and advise
>> the sender by return email or telephone.
>>
>> Deakin University does not warrant that this email and any attachments are
>> error or virus free.
>>
>>          [[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.
>>
>
> 	[[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