Skip to main content
fixed spelling of 'Wikipedia'
Source Link
Glen_b
  • 290.5k
  • 37
  • 652
  • 1.1k

The F-statistics tells you if the model fits the data better than the mean. Or, in other words, if $H_0:\;R^2=0$ should be rejected.

See: WikpediaWikipedia

To illustrate that the formula given in the link is indeed used by summary.lm:

x1 <- 1:10
set.seed(42)
x2 <- rnorm(10)
y <- x1+2*x2+rnorm(10)

fit0 <- lm(y~1)
fit1 <- lm(y~x1+x2)

summary(fit1)
#F-statistic:  14.1 on 2 and 7 DF,  p-value: 0.003507 

RSS0 <- sum(residuals(fit0)^2)
RSS1 <- sum(residuals(fit1)^2)

Fvalue <- (RSS0-RSS1)/(3-1)/RSS1*(10-3)
#14.10014
pf(Fvalue,2,7,lower.tail=FALSE)
#0.00350697

The F-statistics tells you if the model fits the data better than the mean. Or, in other words, if $H_0:\;R^2=0$ should be rejected.

See: Wikpedia

To illustrate that the formula given in the link is indeed used by summary.lm:

x1 <- 1:10
set.seed(42)
x2 <- rnorm(10)
y <- x1+2*x2+rnorm(10)

fit0 <- lm(y~1)
fit1 <- lm(y~x1+x2)

summary(fit1)
#F-statistic:  14.1 on 2 and 7 DF,  p-value: 0.003507 

RSS0 <- sum(residuals(fit0)^2)
RSS1 <- sum(residuals(fit1)^2)

Fvalue <- (RSS0-RSS1)/(3-1)/RSS1*(10-3)
#14.10014
pf(Fvalue,2,7,lower.tail=FALSE)
#0.00350697

The F-statistics tells you if the model fits the data better than the mean. Or, in other words, if $H_0:\;R^2=0$ should be rejected.

See: Wikipedia

To illustrate that the formula given in the link is indeed used by summary.lm:

x1 <- 1:10
set.seed(42)
x2 <- rnorm(10)
y <- x1+2*x2+rnorm(10)

fit0 <- lm(y~1)
fit1 <- lm(y~x1+x2)

summary(fit1)
#F-statistic:  14.1 on 2 and 7 DF,  p-value: 0.003507 

RSS0 <- sum(residuals(fit0)^2)
RSS1 <- sum(residuals(fit1)^2)

Fvalue <- (RSS0-RSS1)/(3-1)/RSS1*(10-3)
#14.10014
pf(Fvalue,2,7,lower.tail=FALSE)
#0.00350697
Source Link
Roland
  • 7.1k
  • 1
  • 38
  • 68

The F-statistics tells you if the model fits the data better than the mean. Or, in other words, if $H_0:\;R^2=0$ should be rejected.

See: Wikpedia

To illustrate that the formula given in the link is indeed used by summary.lm:

x1 <- 1:10
set.seed(42)
x2 <- rnorm(10)
y <- x1+2*x2+rnorm(10)

fit0 <- lm(y~1)
fit1 <- lm(y~x1+x2)

summary(fit1)
#F-statistic:  14.1 on 2 and 7 DF,  p-value: 0.003507 

RSS0 <- sum(residuals(fit0)^2)
RSS1 <- sum(residuals(fit1)^2)

Fvalue <- (RSS0-RSS1)/(3-1)/RSS1*(10-3)
#14.10014
pf(Fvalue,2,7,lower.tail=FALSE)
#0.00350697