I am running a regression and I'd like to be able to do the calculation to get to the F stat .3062. How is this .3062 calculated? Can you help?
x<-rnorm(20000)
y<-rnorm(20000)
data<- data.frame(x =x, y=y)
fit<-lm(x ~ y)
summary(fit)
####### calculation for r squared
rss<- sum(resid(fit)^2)
meanX<-mean(x)
tss<- sum( (x - meanX)^2)
r.squared<- 1-(rss/tss)
r.squared
Call:
lm(formula = x ~ y)
Residuals:
Min 1Q Median 3Q Max
-3.6405 -0.6794 0.0033 0.6674 4.3485
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.003090 0.007064 0.437 0.662
y 0.003897 0.007043 0.553 0.580
Residual standard error: 0.999 on 19998 degrees of freedom
Multiple R-squared: 1.531e-05, Adjusted R-squared: -3.469e-05
F-statistic: 0.3062 on 1 and 19998 DF, p-value: 0.58