Regression- Testing the Hypothesis that the True Slope is Zero.

727 Views Asked by At

Assume that rent is determined by distance from campus, i.e. R = a + b * D, where R is rent and D is distance from campus.

Here is a dataset of 30 observations:

Rent    Distance

690       36
735       53
570       29
609       53
1350      33
840       35
930       37
555       37
654       71
555       37
1020      32
690       89
735       53
600       65
375       32
900       38
1050      45
300       34
840       35
525       33
930       39
1350      34
480       41
855       33
765       37
1020      32
900       40
2640      35
2400      39
1350      34

$(i)$ Using this data, find:

The slope of the regression line and the intercept of the regression line.

$(ii)$ Test the hypothesis that the true slope is $0$ using a chance of Type $1$ error of $5%$ ($2$-tailed test). Find:

Test statistic, critical value, and whether you accept or reject the null hypothesis.

Attempted Solution:

For $(i)$ I simply made a scatter plot in excel and obtained a slope of $-6.9613$ with an intercept at $1195.1$.

For $(ii)$, I am not sure if I did this correctly. I read $df_1$ = number of variables minus 1 and $df_2$ = sample size - number of variables to obtain $df_1$ = $1$ and $df_2$ = $28$. By chart, I then got $5.61$ as the critical value. Then to find the test statistic, I used the formula T = $R\sqrt{N-2\over{1-R^2}}$ to obtain a test statistic of $0.973678$, thus accepting the null hypothesis.

Any help figuring out if I did this correctly, particularly $(ii)$ would be much appreciated.

1

There are 1 best solutions below

5
On BEST ANSWER

When loading the data in R the following results show up:

lm.fit <- lm(data$Rent~data$Distance)
summary(lm.fit)

Results in the output:

Call:
lm(formula = data$Rent ~ data$Distance)

Residuals:
    Min      1Q  Median      3Q     Max 
-658.38 -245.12  -91.12   47.70 1688.58 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)   1195.068    310.252   3.852 0.000624 ***
data$Distance   -6.961      7.149  -0.974 0.338521    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 513.8 on 28 degrees of freedom
Multiple R-squared:  0.03275,   Adjusted R-squared:  -0.00179 
F-statistic: 0.9482 on 1 and 28 DF,  p-value: 0.3385

The test-statistic seems similar as yours. $t=-0.974$ with a $p$ value of $0.338$ which results in insufficient evidence to reject the null.

I would calculate this manually as follows:

One knows how $\hat \beta_1 \stackrel{d}{=} N\left(\beta_1, \dfrac{\sigma^2}{\sum_i (x_i-\overline x)^2} \right)$ which results in the teststatistic: $$\dfrac{\hat \beta_1 - \beta_{10}}{s(\hat \beta_1)} \stackrel{d}{=} t_{n-2} \qquad \beta_{10} = \beta_1 \text{ under the null}$$

Where $s^2(\hat \beta_1) = \dfrac{\text{MSE}}{\sum_i(x_i-\overline x)^2}$ which implies here:

$$T = \frac{-6.961}{\sqrt{51.11}} =-0.974 $$

You're teststatistic seems interesting, I recognize it, but it seems to yield the same result. I'll dive into it.

EDIT:

Okay, both test-statistics are equivalent, since: $$\begin{align} R\sqrt{\dfrac{n-2}{1-R^2}}&= \hat\beta_1 \cdot \dfrac{s_X}{s_Y} \sqrt{\dfrac{n-2}{\dfrac{\text{SSE}}{\text{SSTO}}}}\\ &= \hat\beta_1 \cdot \dfrac{s_X}{s_Y} \sqrt{\dfrac{\text{SSTO}}{\text{MSE}}}\\ & = \hat\beta_1 \cdot s_X \sqrt{\dfrac{n-1}{\text{MSE}}}\\ &= \hat \beta_1 \cdot \sqrt{\dfrac{s_X^2(n-1)}{\text{MSE}}}\\ &= \hat \beta_1 \cdot \sqrt{\dfrac{\sum_i (x_i-\overline x)^2}{\text{MSE}}} \end{align}$$