Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: why is the F-statistic missing in OLS reported results?


From   "Caskey, Judson" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: why is the F-statistic missing in OLS reported results?
Date   Fri, 30 Jul 2010 12:42:03 -0700

I found that I get this problem when the regression drops regressors (e.g. using xi and i.x indicator variables, where the regression drops some variables). Here is a solution that is ugly, but nonetheless works. What it does is performs an F-test on the included regressors by first scanning through the variables in the regression and dropping the constant and any omitted regressors. Like I said, ugly, but functional. The F-stat will not appear if you try to view the results using "est replay", but it will appear if you use estout.

Here is example code:

capture program drop makefstat
program makefstat
                matrix b=e(b)
                local tmp1 : colnames b
                local tmp2 : word count `tmp1'
                local tmpvlist ""
                forvalues k=1(1)`tmp2' {
                                local tmpv : word `k' of `tmp1'
                                if substr("`tmpv'",1,2) ~= "o." & "`tmpv'" ~= "_cons" {
                                                local tmpvlist "`tmpvlist' `tmpv'"
                                                }
                                }
                                qui test `tmpvlist'
                                estadd scalar F=r(F), replace
                                estadd scalar df_m=r(df), replace
                end

qui xi: regress y x1 x2 i.x3 i.x4, robust cluster(x3)
makefstat

estout, cells(b(star) t) stats(N r2_a F, star(F)) starlevels(* 0.1 ** 0.05 *** 0.01)

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index