# Finding range of p-values from linear regression model

A statistical relationship model has the following data:

$$\text{Sample size: }n=18$$ $$\text{Relationship: }Y_i = \alpha + \beta x_i +R_i, R_i \sim G(0,\sigma), i\in \{1,\dots,18\}, \text{ independent}$$ $$\text{Parameter estimates: } \hat{\alpha}=-7, \hat{\beta}=1.2, s_e = 12.36, \overline{x}=69.06, S_{xx}=1482$$

Given these data, I want to find an appropriate range for the p-value to be used to test that there is no relationship between $x$ and $Y$, that is that $H_0: \beta =0$ against the alternative, $H_a:\beta\ne 0$.

I can use tables or R to determine this range. But to determine the $t$ value I need to determine two imput values: a quantile $q$ and the degrees of freedom, which I think there are $n-1=17$.

How does one determine the parameter $q$ given the above data? Also, how can we construct 95% confidence and prediction intervals with this value of $t$? Unfortunately, I seem to lack this specific knowledge.

• Degrees of freedom for the t-statistic would be $n-2=16. \qquad$ – Michael Hardy Nov 28 '17 at 6:40

The formulas you seek can be found on Wikipedia.

The quantile will be $$\frac{\hat{\beta} - 0}{\operatorname{s.e.}(\hat{\beta})}$$ where $$\operatorname{s.e.}(\hat{\beta}) = \sqrt{\frac{\frac{1}{n-2} \sum_{i=1}^n \hat{e}_i^2}{\sum_{i=1}^n (x_i - \bar{x})^2}} \overset{?}{=} \frac{s_e}{S_{xx}}.$$ (I am not sure how your quantities are defined, so I am not sure if the last equality is correct. Here, $\hat{e}_i$ are the residuals.)

The degrees of freedom is actually $n - 2$ (the minus $2$ is due to the two parameters in your model: $\alpha$ and $\beta$).

Response to comment:

If your $q$ is correct, then you should do 2*(1 - pt(1439,16)) for the $p$-value of a two-sided $t$-test. pt() is the CDF of the $t$-distribution, so it give you the probability on the interval $(-\infty, 1439]$. Intuitively, the $p$-value is nearly zero since $1439$ is very far in the tails of the distribution.

Of course this is contingent on the computation for $q$ being correct, but I suspect it is not. I suspect the standard error should be $\frac{12.36}{\sqrt{1482}}$ rather than $\frac{12.36}{1482}$. Only you can check this, since I do not know how your $S_{xx}$ is defined.

• So I found $s.e.(\beta)=0.00834$ and $q=1439$. Now $pt(1439, 16)=1$ in R. Can you please point out what is it that I'm doing wrong? – sequence Nov 28 '17 at 7:35
• @sequence See my update. – angryavian Nov 28 '17 at 7:44
• Thanks. I had made a typo. Now with $s.e.(\hat{\beta})=\frac{12.36}{\sqrt{1482}}\approx 0.3211$ I get $q=3.74$ and the p-value is approximately $0.00179$. But how does one determine the range for the p-value if this is just one value? – sequence Nov 28 '17 at 7:53
• @sequence This terminology "determine the range for the $p$-value" is unfamiliar to me. You pick a level, say $\alpha=5\%$, before you do the test, and you "reject the null hypothesis at level $\alpha$" if the $p$-value that you obtain is $<\alpha$. – angryavian Nov 28 '17 at 8:00
• It is mentioned that somehow it is possible to find the range using the t-table, but I'm not sure how. @angryavian – sequence Nov 28 '17 at 8:15