Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: problem with ciplot


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: problem with ciplot
Date   Wed, 27 Aug 2003 15:07:54 +0100

cecilia vidal

> I have a dataset of children with two dummy variables indicating the
> proportion of deaths (one for boys and one for girls)
> before age of five:
>
> gen u5yrd_m=.; replace u5yrd_m=1 if (sex==1 & died==1);
> replace u5yrd_m=0 if
> (sex==1 & died==0);
> gen u5yrd_f=.; replace u5yrd_f=1 if (sex==2 & died==1);
> replace u5yrd_f=0 if
> (sex==2 & died==0);
>
> I would like to plot the proportions with confidence
> intervals for both
> variables in one graph using
> ciplot u5yrd_m u5yrd_f, by(groupvar);
>
> but i keep getting the message "no observations". Would
> anyone know why is
> this happening?

Let me replay your operations, with some simplification,

gen u5yrd_m = died if sex==1
gen u5yrd_f = died if sex==2
ciplot u5yrd_m u5yrd_f, by(groupvar)

You have variables for male and female
deaths. When male deaths are not-missing
female deaths are missing, and vice versa.

-ciplot- by default will not proceed further,
because it expects to work on the same set
of observations.

(A way to get closer to what -ciplot- is thinking
is to

set trace on

and see where you are ejected.)

There are two choices:

1. Cecilia is working with some version of -ciplot-
before 1.1.0. -ciplot- 1.1.0 has an undocumented
-inclusive- option added on 18 August 2003,
which can be used to override this default. The
syntax would be

ciplot u5yrd_?, by(groupvar) inclusive

This 1.1.0 is not yet on SSC. I'll send
a copy to Cecilia privately.

2. A different data structure. There is
some -groupvar- here unexplained, but
presumably it is something other than -sex-.

egen GROUPVAR = group(sex groupvar), label
ciplot died, by(GROUPVAR)

should move you closer to where you want
to be. You will probably have to work a bit
on the labelling.

By the way, -ciplot- works with similar syntax
to -ci-. If you wanted binomial or Poisson
confidence intervals, you need to state that
explicitly.

Nick
[email protected]


*
*   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