RE: [R] linear regression: evaluating the result Q

2004-12-14 Thread Liaw, Andy
It looks just like the classical F-test for lack-of-fit, using estimate of
`pure errors' from replicates, doesn't it?  This should be in most applied
regression books.  The power (i.e., probability of finding lack-of-fit when
it exists) of such tests will depend on the data.

Andy

> From: RenE J.V. Bertin
> 
> Hello,
> 
> I'd like to come back to this question I obtained some 
> valuable help with a while ago.
> 
> I just came across a paper applying a seemingly rather 
> clever/elegant technique to assess the extent to which a 
> linear fit is appropriate, given once data. These authors 
> apply an ANOVA to the residuals, and take a NS result as an 
> indication that the fitted relationship is indeed 
> (sufficiently) linear.
> 
> But is this a clever/elegant technique, and is it good and robust?
> A rather pathological example where it fails (I think):
> 
> ##> kk<-data.frame( ordered(factor( rep( 1:25, each=11))), 
> ordered(factor(rep( 0:10, 25))), sin( pi*jitter(rep(0:10,25))) )
> ##> names(kk)<-c("s","x","y")
> ##> summary( aov(y~x+Error(s), data=kk) )
> 
> Error: s
>   Df Sum Sq Mean Sq F value Pr(>F)
> Residuals 24  2.592   0.108   
> 
> Error: Within
>Df Sum Sq Mean Sq F value Pr(>F)
> x  10  1.174   0.117   0.974  0.467
> Residuals 240 28.924   0.121   
> 
> (it doesn't fail when using a cosine instead of a sine, of course).
> 
> And if so, before I reinvent the wheel in implementing it 
> myself: is anyone here aware of an existing implementation of 
> a test that does just that?
> 
> Thanks,
> RenE Bertin
> 
> __
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] linear regression: evaluating the result Q

2004-09-16 Thread Prof Brian Ripley
On Thu, 16 Sep 2004, RenE J.V. Bertin wrote:

> On Thu, 16 Sep 2004 17:03:09 +0100 (BST), Prof Brian Ripley <[EMAIL PROTECTED]> 
> wrote regarding
> "Re: [R] linear regression: evaluating the result Q"
> 
> Thank you, that should get me going into the right direction!
> 
> 8-) Well, for rlm no, as it is not least-squares fitting and R^2 is very 
> 8-) suseptible to outliers.  For glm, not really unless it is a Gaussian 
> 8-) model.
> 
>   This is what I feared. How then would one evaluate the goodness of
> an rlm fit, on a comparable 0-1 scale?

Via the estimated robust scales.

> 8-) > Aside from question 2), what is the best way to compare
> 8-) > the calculated slope with another slope (say of the unity line)?
> 8-) 
> 8-) Use offset, as in y ~ x + offset(x) and test for the coefficient of x to
> 8-) be zero.  (That's R only, BTW.)
> 
> offset seems to be ignored by rlm(), is that correct? (Which isn't too
> much of a problem as long as confint operates correctly on rlm objects.)

Yes -- rlm was written before R existed.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] linear regression: evaluating the result Q

2004-09-16 Thread Prof Brian Ripley
On Thu, 16 Sep 2004, RenE J.V. Bertin wrote:

> Dear all,
> 
> A few quick questions about interpreting and evaluating the results of
> linear regressions, to which I hope equally quick answers are possible.
> 
> 1) The summary.lm method prints the R and R^2 correlation coefficients
> (something reviewers like to see). It works on glm objects and (after
> tweaking it to initialise z$df.residual with rdf) also on rlm objects.
> Are the R, R^2 and also the p values reported reliable for these fit
> results? If not, how do I calculate them best?

Well, for rlm no, as it is not least-squares fitting and R^2 is very 
suseptible to outliers.  For glm, not really unless it is a Gaussian 
model.

> 2) For a simple 1st order linear fit, what is the best way to calculate
> the (95%) confidence interval on/of the slope?

Use confint.  (MASS chapter 7 has examples.)

> 3) The p values reported for the calculated coefficients and intercept
> indicate to what extent these values are significantly different from
> zero (right?). 

Yes.

> Aside from question 2), what is the best way to compare
> the calculated slope with another slope (say of the unity line)?

Use offset, as in y ~ x + offset(x) and test for the coefficient of x to
be zero.  (That's R only, BTW.)

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html