Computational formulae for simple linear regression

advertisement
Computational formulae for simple linear regression
Linear model : Yi = α + βXi + εi
a is the estimate of the true intercept, α, and
b is the estimate of the true slope β
n is the sample size (number of pairs of points)
εi are random elements (residuals) sampled from a normal distribution N(0, σε2)
𝑏=
∑𝑛𝑖=1 𝑋𝑖𝑌𝑖 − (∑𝑛𝑖=1 𝑋𝑖 ∑𝑛𝑖=1 𝑌𝑖) /𝑛
2
∑𝑛𝑖=1 𝑋𝑖 2 − (∑𝑛𝑖=1 𝑋𝑖 ) /𝑛
𝑎 = 𝑌̅ − 𝑏𝑋̅
To carry out a t-test for the slope, we need to estimate the standard error of the slope, Sb as follows:
𝑛
𝑆𝑆𝑒𝑟𝑟𝑜𝑟 = ∑ 𝑌𝑖 2 −
𝑖=1
𝑀𝑆𝑒𝑟𝑟𝑜𝑟 =
(∑𝑛𝑖=1 𝑌𝑖 )2 (∑𝑛𝑖=1 𝑋𝑖𝑌𝑖 − (∑𝑛𝑖=1 𝑋𝑖 ∑𝑛𝑖=1 𝑌𝑖) /𝑛 )2
−
2
𝑛
∑𝑛𝑖=1 𝑋𝑖 2 − (∑𝑛𝑖=1 𝑋𝑖 ) /𝑛
𝑆𝑆𝑒𝑟𝑟𝑜𝑟
𝑛−2
𝑀𝑆𝑒𝑟𝑟𝑜𝑟
𝑆𝑏 = √
2
𝑛
∑𝑖=1 𝑋𝑖 2 − (∑𝑛𝑖=1 𝑋𝑖 ) /𝑛
Finally the test statistic, t is calculated as:
𝑡=
𝑏−𝛽
,
𝑆𝑏
Here β is the slope as specified in the null Hypothesis (most commonly β = 0)
The critical value of Student’s t-distribution is obtained with degrees of freedom, DF = n-2.
Note that 1 or 2-tailed tests can be conducted.
Download