Skip to content
Prev 76659 / 398502 Next

R-square n p-value

Dirk Eddelbuettel <edd at debian.org> writes:
I think the problem was somewhat different: The *input* is coming from
some sort of (closed-source or otherwise impenetrable) database which
only gives out n and R^2, right?

Now R^2 = SSDmodel/(SSDmodel+SSDres) and F =
DFres/DFmodel*SSDmodel/SSDres, i.e. 

  1/R^2 = 1 + 1/F*DFmodel/DFres

or 

  F = 1/(1/R^2 - 1)*DFres/DFmodel = R^2/(1-R^2)*DFres/DFmodel

which can be looked up "in the F-table" using 

  pf(F, 1, N-2, lower.tail=FALSE)
 
(provided we have a 1 DF model)

Actually, R^2 itself has a beta distribution and you could use pbeta
directly, but then you'd need to figure out (or recall) what the
relation between the DF and the shape parameters of the beta
distribution are. By my reckoning, this should do it:

  pbeta(Rsq, 1/2, (N-2)/2, lower.tail=FALSE) 

"Proof":

....
Residual standard error: 1.143 on 8 degrees of freedom
Multiple R-Squared: 0.0004207,  Adjusted R-squared: -0.1245
F-statistic: 0.003367 on 1 and 8 DF,  p-value: 0.9552
[1] 0.9551511