Hi everyone,
I'm working on code to apply certain types of standard error corrections to GEE analyses. I want to be able to output a regression table to the Stata output window that looks like the standard Stata regression output table.
So, first, see below for the code running the standard xtgee command to run a GEE model.
I then apply a certain correction to the standard errors. If I keep the same z-statistic, it is easy enough to get an updated regression output table after using ereturn repost followed by _coef_table, as follows:
However, I also want to be able to use a t-statistic, which according to simulations under certain types of corrections is a better option, but which xtgee does not provide an option for. (Note that in this case there is no difference between the t-statistic and z-statistic, but ignore that for now.) Thus, I compute the t-statistic and updated p-value separately, but I don't think there's a way to update these using ereturn repost. So, the closest I've been able to come to recreating the format of the regression output is using tabdisp, but there are a couple issues. (I've used the list command, but the output doesn't look as nice.) One is that tabdisp sorts the data by the first column automatically, and I'm not sure how to override this. The other is that I can't figure out how to get the columns to be the width I want them to be. I've tried reformatting the numbers and also formatting them as strings and then trimming leading blanks, but this doesn't seem to have any effect. Also, tabdisp does provide a column width changer, but it changes all columns at once, which I don't want. I would want each column to be a different width. See below:
Any ideas for how to solve this issue, potentially of alternative commands I could use, or a way to get ereturn repost to update the statistic and p-value?
Thank you,
John
I'm working on code to apply certain types of standard error corrections to GEE analyses. I want to be able to output a regression table to the Stata output window that looks like the standard Stata regression output table.
So, first, see below for the code running the standard xtgee command to run a GEE model.
Code:
xtgee know arm stratum_2 stratum_3 ethnicgp_2, family(binomial) link(logit) scale(phi) nmp eform GEE population-averaged model Number of obs = 4,100 Group variable: community Number of groups = 20 Link: logit Obs per group: Family: binomial min = 169 Correlation: exchangeable avg = 205.0 max = 257 Wald chi2(4) = 43.94 Scale parameter: .9957369 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ know | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- arm | 2.286608 .3382258 5.59 0.000 1.71114 3.055611 stratum_2 | 1.051687 .1881703 0.28 0.778 .7406063 1.493432 stratum_3 | 1.133454 .2176577 0.65 0.514 .7779419 1.651431 ethnicgp_2 | .737854 .0647369 -3.47 0.001 .621282 .8762986 _cons | .9892138 .1621198 -0.07 0.947 .7174454 1.363928 ------------------------------------------------------------------------------ Note: _cons estimates baseline odds (conditional on zero random effects).
Code:
_coef_table, eform ------------------------------------------------------------------------------ know | exp(b) Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- arm | 2.286608 .4261085 4.44 0.000 1.586977 3.294677 stratum_2 | 1.051687 .2531373 0.21 0.834 .656153 1.685651 stratum_3 | 1.133454 .269032 0.53 0.598 .7118133 1.804852 ethnicgp_2 | .737854 .0793335 -2.83 0.005 .5976541 .9109426 _cons | .9892138 .2181314 -0.05 0.961 .642084 1.524013 ------------------------------------------------------------------------------
Code:
tabdisp know, cell(exp_Coef StdErr t pval CI) ------------------------------------------------------------------------------------------------------------------------- know | Odds Ratio Std. Err. t P>|t| [95% Conf. Interval] -----------+------------------------------------------------------------------------------------------------------------- _cons | .9892138 .2181314 -.05 .961 .61826 1.5827 arm | 2.286608 .4261086 4.44 0 1.5371 3.4017 ethnicgp_2 | .737854 .0793335 -2.83 .013 .58674 .92789 stratum_2 | 1.051687 .2531373 .21 .837 .62962 1.7567 stratum_3 | 1.133454 .269032 .53 .605 .68342 1.8798 -------------------------------------------------------------------------------------------------------------------------
Thank you,
John
Comment