Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 2.04 KB

1.4.5.md

File metadata and controls

52 lines (40 loc) · 2.04 KB

Solution to Review Question

by Qiang Gao, updated at May 11, 2017


Chapter 1 Finite-Sample Properties of OLS

Section 4 Hypothesis Testing under Normality

...

Review Question 1.4.5 (Relation between $$F(1, n - K)$$ and $$t(n - K)$$)

Look up the $$t$$ and $$F$$ distribution tables to verify that $$ F_\alpha(1, n - K) = ( t_{\alpha / 2} (n - K) )^2 $$ for degrees of freedom and significance levels of your choice.

Solution

We can verify their equality by following Python code.

In [1]: import numpy as np
In [2]: from scipy.stats import t  # the t-distribution
In [3]: from scipy.stats import f  # the F-distribution
In [4]: sz = [0.05, 0.01, 0.005, 0.001]  # sizes
In [5]: df = [20, 40, 60, 80, 100, 200, 500, 1000]  # degrees of freedom
In [6]: SZ, DF = np.meshgrid(sz, df)  # generate meshgrid table
In [7]: f.isf(SZ, 1, DF)  # isf = inverse survival function = 1 - cdf
Out[7]:
array([[  4.3512435 ,   8.09595806,   9.94393492,  14.81877555],
       [  4.08474573,   7.31409993,   8.82785886,  12.60935783],
       [  4.00119138,   7.07710579,   8.49461671,  11.97298729],
       [  3.96035242,   6.96268806,   8.33460762,  11.67136163],
       [  3.93614299,   6.89530103,   8.24064017,  11.49543133],
       [  3.88837472,   6.76329947,   8.05715996,  11.15450054],
       [  3.86012404,   6.68583329,   7.94984966,  10.95670343],
       [  3.85077467,   6.66029481,   7.91453232,  10.89186556]])
In [8]: t.isf(SZ/2, DF)**2  # isf = inverse survival function = 1 - cdf
Out[8]:
array([[  4.3512435 ,   8.09595806,   9.94393492,  14.81877554],
       [  4.0847457 ,   7.31409993,   8.82785886,  12.60935783],
       [  4.00119137,   7.07710581,   8.49461671,  11.97298729],
       [  3.96035242,   6.96268805,   8.33460759,  11.67136163],
       [  3.93614299,   6.89530103,   8.24064016,  11.49543139],
       [  3.88837472,   6.76329947,   8.05715996,  11.15450054],
       [  3.86012404,   6.68583329,   7.94984966,  10.95670343],
       [  3.85077467,   6.66029481,   7.91453232,  10.89186556]])

Copyright ©2017 by Qiang Gao