[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: error bars |

Date |
Mon, 16 Jun 2008 13:23:57 +0100 |

Standard errors can come from lots of places, including the -ci- command. Moleps seems to be implying that -ci- does the right calculation for his or her purposes. (I note that Moleps has yearly results, but -ci- for separate years does nothing about any time series structure in the data, for example about taking serial correlation into account.) -ciplot- and -stripplot- from SSC both do -ci-type calculations and graphing in one. Nick n.j.cox@durham.ac.uk Maarten buis --- moleps islon <moleps2@gmail.com> wrote: > I need to make a an error-bar graph categorised by year. I've tried > using serrbar mean(x) etc, but I cant find a command for the standard > error. Do I need to run a CI, generate a new variable from the ci > result and feed that into serrbar? There are many ways of doing this. For instance you can use methods discussed in (Buis 2007) (a convenient estimatation command would in this case be -mean-), or you can remember that the standard error of the mean is the standard deviation divided by the square root of the number of observations, like in the example below: *-------------- begin example ----------------------- sysuse nlsw88, clear gen mis = missing(wage, age) bys age: egen mwage = mean(wage) bys age: egen sdwage = sd(wage) bys age mis: gen se = sdwage/sqrt(_N) if mis == 0 serrbar mwage se age, scale(1.96) *-------------- end example ------------------------- Notice that a fixed scale is slightly problematic here as idealy this scale should depend on the number of observations (a t-test), but 1.96 should work fine in large samples. For a more flexible approach, where you can take all this into account see: (Newson 2003) -- maarten M.L. Buis (2007), "Stata tip 54: Where did my p-values go?", The Stata Journal, 7(4), pp.584--586. http://home.fsw.vu.nl/m.buis/wp/pvalue.html R. Newson (2003), "Confidence intervals and p-values for delivery to the end user", The Stata Journal, 3(3), pp. 245--269. http://www.stata-journal.com/article.html?article=st0043 * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: error bars***From:*"moleps islon" <moleps2@gmail.com>

**References**:**st: error bars***From:*"moleps islon" <moleps2@gmail.com>

**Re: st: error bars***From:*Maarten buis <maartenbuis@yahoo.co.uk>

- Prev by Date:
**Re: st: error bars** - Next by Date:
**st: accessing sum of weights** - Previous by thread:
**Re: st: error bars** - Next by thread:
**Re: st: error bars** - Index(es):

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