clear all ************************************ *** Example: Critical & p-values *** ************************************ * t statistic value for df degrees of freedom and area of right tail p: invttail(df, p) * display invttail(25, 0.025) display invttail(50, 0.025) display invttail(200, 0.025) * standard normal value for area of right tail p: invnormal(1-p) * display invnormal(0.975) * p-value for 2-tailed tests for t statistic value t and df degrees of freedom: 2*ttail(df, |t|) * display 2*ttail(25, 1.96) display 2*ttail(50, 1.96) display 2*ttail(200, 1.96) * p-value for 2-tailed tests for standard normal value z: 2*(1-normal(|z|)) * display 2*(1-normal(1.96)) * F statistic value for df1 (q) and df2 (n-k-1) degrees of freedom and area of right tail p: invFtail(df1, df2, p) * display invFtail(2, 60, 0.05) * p-value for F statistic value f and df1 (q) and df2 (n-k-1) degrees of freedom: Ftail(df1, df2, f) * display Ftail(2, 60, 3.15) ********************************** *** Example: Hypothesis tests *** ********************************** use "S:\COB\ECO\RoyJ\5720\nbasal.dta", clear reg wage points rebounds assists * test statistic for testing that the coefficient corresponding to points is 70 * display (_b[points]-70)/_se[points] lincom points - 70 /* displays t statistic */ test points = 70 /* displays F statistic or the square of t */ * test that the coefficients corresponding to points and rebounds are equal * lincom points - rebounds /* displays t statistic */ test points - rebounds = 0 /* displays F statistic or the square of t */ * joint test that the coefficients corresponding to points and rebounds are both zero * test points rebounds * alternatively * *unrestricted model - SSR and Rsq reg wage points rebounds assists g ssr_ur=e(rss) g rsq_ur=e(r2) *restricted model and SSR reg wage assists g ssr_r=e(rss) g rsq_r=e(r2) di "F statistic based on SSR = " [(ssr_r-ssr_ur)/2]/[ssr_ur/(269-3-1)] di "F statistic based on R squared = " [(rsq_ur-rsq_r)/2]/[(1-rsq_ur)/(269-3-1)]