Reputation: 31
I want to test the hypothesis
H0: B1 = 0 HA: B1 =/= 0
with a 5% significance.
Is there a function for this kind of hypothesis testing?
What i currently got is:
Y X
1 1890 2075
2 2790 2800
3 1390 1450
4 990 1175
5 1290 1290
6 1300 1400
7 1890 1850
8 1090 1070
9 1290 1240
10 2290 2480
11 2690 3010
12 1780 1850
13 1490 1490
14 1850 1910
15 1850 1880
16 1390 1420
17 1560 1850
18 2290 2260
19 990 1175
20 1290 1240
mod1 <- lm(d1$Y ~ d1$X)
Call:
lm(formula = d1$husdata.Salgssum ~ d1$husdata.Prisantydning)
Residuals:
Min 1Q Median 3Q Max
-129.48 -82.97 -29.40 93.02 217.85
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 13.75734 86.65964 0.159 0.876
d1$husdata.Prisantydning 1.03743 0.04962 20.910 4.46e-14 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 113.9 on 18 degrees of freedom
Multiple R-squared: 0.9605, Adjusted R-squared: 0.9583
F-statistic: 437.2 on 1 and 18 DF, p-value: 4.464e-14
I've found the critical value using the qt function, and have manually taking the estimation divided by std.error.
And then manually assess the the test value against the critical value.
qt(0.025, 18)
13.75734/86.65964
Upvotes: 0
Views: 1414
Reputation: 4456
The coefficients table already has that answer!
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 13.75734 86.65964 0.159 0.876
d1$husdata.Prisantydning 1.03743 0.04962 20.910 4.46e-14 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
The third column is the value of the test statistics of the null coefficient of the row = 0. The fourth is the probability of wrongly rejecting the null (p-value).
In your case, the p-value of the coefficient you're interested in is 4.46e-14 (very low, below 5%).
Upvotes: 1