Inferences about B (the population slope)
In a simple linear regression model, the relationship between an explanatory variable x and a response
variable y is described by a line plus random error:
\[
y = A + Bx + \varepsilon
\]
Here, B is the population slope (how much the mean of y changes for a 1-unit increase in x).
Because B is unknown, it is estimated from sample data using the sample slope b.
This calculator builds a confidence interval for B and performs a hypothesis test about B.
What the calculator computes
- The fitted regression line \(\hat{y} = a + bx\).
- The standard deviation of random errors (estimated): \(s_e\).
- The standard error of the slope: \(s_b\).
- A \((1-\alpha)100\%\) confidence interval for \(B\).
- A t-test for \(B\) (test statistic, p-value, and decision).
How to use the calculator
- Enter data as \((x,y)\) pairs by pasting into the textbox, or upload a CSV file.
- Choose a confidence level (or \(\alpha\)) for the confidence interval.
- Set up the hypothesis test by entering \(B_0\) (the slope in \(H_0\)) and selecting the alternative:
\(B \ne B_0\), \(B > B_0\), or \(B < B_0\).
- Click Calculate to see the graph, numerical results, and the step-by-step derivation.
The test uses \(df = n - 2\). You need at least 3 data points (\(n \ge 3\)).
Key formulas
1) Error variation and degrees of freedom
\[
\mathrm{SSE} = \sum (y - \hat{y})^2,
\qquad
s_e = \sqrt{\frac{\mathrm{SSE}}{n - 2}},
\qquad
df = n - 2
\]
2) Variation in x and the standard error of the slope
\[
\mathrm{SS}_{xx} = \sum (x - \bar{x})^2,
\qquad
s_b = \frac{s_e}{\sqrt{\mathrm{SS}_{xx}}}
\]
3) Confidence interval for \(B\)
\[
(1-\alpha)100\% \ \text{CI for } B:
\qquad
b \pm t_{\alpha/2,\;n-2}\, s_b
\]
4) Hypothesis test about \(B\)
\[
H_0: B = B_0
\qquad \text{vs.} \qquad
H_1: B \ne B_0 \ \text{(or } B > B_0,\ B < B_0\text{)}
\]
\[
t = \frac{b - B_0}{s_b}
\qquad \text{with } df = n - 2
\]
The calculator reports the p-value for your chosen alternative and a decision by comparing the p-value to \(\alpha\).
Interpretation tips
-
If the confidence interval for \(B\) does not contain \(B_0\), then the test at level \(\alpha\) would reject \(H_0\).
-
A positive slope estimate (\(b > 0\)) suggests \(y\) tends to increase as \(x\) increases; a negative slope suggests the opposite.
-
The size of \(s_b\) reflects how precisely the slope is estimated: smaller \(s_b\) means a tighter confidence interval.
Assumptions (for reliable inference)
- Linearity: the mean of \(y\) changes approximately linearly with \(x\).
- Independence of errors.
- Constant variance (homoscedasticity) of errors across \(x\).
- Errors are approximately normal (especially important for small \(n\)).