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

From |
Roy Wada <roywada@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Update to outreg2 available from ssc |

Date |
Mon, 16 Nov 2009 21:41:13 -0800 |

Thanks to Kit Baum, recent author of "An Introduction to Stata Programming," an update to outreg2 is available from ssc. stats( ) option has been expanded to include the following sub-options: coef se tstat pval ci ci_low ci_high aster beta N sum_w mean Var sd sum min max skewness kurtosis p1 p5 p10 p25 p50 p75 p90 p95 p99 corr pwcorr spearman str( ) cmd( : ) I actually don't like to add functionalities that are covered by other user-written programs but it looks like the damage has been already done. I hope this is clear. Adding a new functionality is not that difficult. All I have to do have it dumped into a table. This feature has been made into a new option so that users can do it themselves like this: * insert correlation under coefficient: sysuse auto, clear reg rep78 headroom length turn gear_ratio outreg2 using myfile, replace stats(coef cmd( r(rho):corr ) ) This has been hard-coded so that it looks like this: outreg2 using myfile, replace stats(coef corr) Basically you can insert any macros produced by r-class command. Or you can write your own program. This means you can pretty much define and insert whatever you want, i.e. covariance, variable labels, correlation ratios, one-sided t-statistics, 5th momentum, etc. For example, coefficient of variation can be defined and inserted like this: * r-class program for coefficient of variation prog define coefvar, rclass syntax varlist(max=2) [if] gettoken dep indep : varlist qui sum `indep' `if' local variation=`r(sd)'/`r(mean)'*100 ret scalar variation=`variation' end * test it sysuse auto, clear reg rep78 headroom length turn gear_ratio coefvar rep78 headroom if e(sample) ret list * run it reg rep78 headroom length turn gear_ratio outreg2 using myfile, replace stats(sd cmd(r(variation): coefvar)) If this were to be hard-coded into outreg2, the r-class program would be pasted into the bottom of the ado file and the name added to the list of valid names. That's it. If someone happened to write a program for producing index or statistics of interest like this and thought it would be useful to others, I will be more than happy to put it into the future version of outreg2 as a sub-option and acknowledge their contribution in the help file. You don't have to write one specifically for this purpose, but if you had something that you thought should be a standard part of table-making commands, then this would be one way to do that. I think I previously mentioned outreg2 is byable, as in -by:- prefix. It will also produce a standard table of summary statistics. And a limited functionality of n-way cross-tabulations. In hindsight I probably should not have sliced in codes that was written several years ago for something else but that's how these guys appear in outreg2. I didn't have the time to clean up the codes or the syntax and so they are. outreg2 also has a limited capacity for [in] [if] [weight]. They are currently left undocumented. They don't work for cross-tabulation. If you find an example where it works funny (strange funny) then you can send it to me and I will take a look at it. What outreg2 is good at is permutation of wide variety of table. With a little imagination you can produce pretty much whatever you want. Some examples are posted here. http://www.stata.com/statalist/archive/2009-11/msg00587.html http://www.stata.com/statalist/archive/2009-11/msg00619.html Roy P.S. I just realized there is an obscure bug. If no regression has been run and outreg2 is invoked with something in the varlist, then it will produce coefficients associated with the varlist. This should be fixed the next time around but I thought I would mention it here. * * 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/

- Prev by Date:
**Re: st: random effects with clustered s.e.** - Next by Date:
**st: AW: RE: Large Datasets Panel Data Logit Limits** - Previous by thread:
**st: random effects with clustered s.e.** - Next by thread:
**st: AW: RE: cf output id and not obs** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |