Statalist


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

Re: st: error bars


From   "moleps islon" <[email protected]>
To   [email protected]
Subject   Re: st: error bars
Date   Wed, 18 Jun 2008 22:17:52 +0200

I' making a double error bar graph- e.g two different variables x and
y with error bars categorised according to z. I've tried using ciplot
x y, by(z) however I get a graph with two identical error bars (though
different symbol, but identical values) for each instance of z. Any
idea how to remedy this? If I need to make bars (a bar graph)  for
each category and then have the positive part of the error bar
projecting from the top- how do I go about this?

Regards


On Mon, Jun 16, 2008 at 2:23 PM, Nick Cox <[email protected]> wrote:
> 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
> [email protected]
>
> Maarten buis
>
> --- moleps islon <[email protected]> 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/
>
*
*   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/



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