Re: [R] need an R-squared from a nls logistic sigmoid fit

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Mon 06 Jun 2005 - 12:10:14 EST

          Gabor explained, "how are we supposed to compare one fit to another" but not "Why doesn't nls() produce any kind of R-squared value". For that, I requested 'RSiteSearch("R-squared from nls")'. The seventh hit was a summary of an earlier discussion on this issue (http://finzi.psych.upenn.edu/R/Rhelp02a/archive/5120.html). Perhaps the most succinct reply was from Doug Bates:

"There is a good reason that an nls model fit in R does not provide r-squared - r-squared doesn't make sense for a general nls model.

One way of thinking of r-squared is as a comparison of the residual sum of squares for the fitted model to the residual sum of squares for a trivial model that consists of a constant only. You cannot guarantee that this is a comparison of nested models when dealing with an nls model. If the models aren't nested this comparison is not terribly meaningful.

  So the answer is that you probably don't want to do this in the first place."

          Doug Bates wrote "nls" in R and is the lead author of my favorite book on the subject. I've learned a lot from him. That would not necessarily stop me from computing an R^2 from nls output, using formula contributed by Andy Jaworski to this earlier discussion. However, I would be careful about how I used that R^2.

          spencer graves

Gabor Grothendieck wrote:

> On 6/5/05, James Salsman <james@bovik.org> wrote:
> 

>>Why doesn't nls() produce any kind of R-squared value? In the absence
>>of such information, how are we supposed to compare one fit to another
>>when the y-axis scale changes?
>>
>>
>>>sm <- nls(y ~ SSfpl(x, miny, maxy, midx, grad))
>>>summary(sm)
>>
>>Formula: y ~ SSfpl(x, miny, maxy, midx, grad)
>>
>>Parameters:
>> Estimate Std. Error t value Pr(>|t|)
>>miny -0.5845 4.6104 -0.127 0.90524
>>maxy 7.2680 1.5512 4.686 0.00941 **
>>midx 16.9187 2.2340 7.573 0.00163 **
>>grad 1.7283 1.9150 0.903 0.41782
>>---
>>Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
>>
>>Residual standard error: 1.13 on 4 degrees of freedom
>>
>>Correlation of Parameter Estimates:
>> miny maxy midx
>>maxy -0.6654
>>midx 0.8936 -0.3221
>>grad -0.9068 0.8477 -0.6865
>>
> 
> 
> One uses anova (which has an anova.nls method) to compare two
> nls models.
> 
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jun 06 12:18:23 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:22 EST