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

From |
Jesper Kjær Hansen <jkh-stata@msecon.eu> |

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

Subject |
RE: st: Getting the exact number of obs. a graph is based on |

Date |
Tue, 2 Oct 2007 06:43:19 +0200 |

Austin, point taken. i.e., it's hard to determine the exact number of observations used in more complicated graphs such as overlaid graphs. I'll make due with the current ad-hoc solutions to determining the number of obs. /Jesper > > Jesper Kjær Hansen <jkh-stata@msecon.eu>: > > I don't think there is one procedure that would work for all graphs. > You might think a -serset- call would give that info, but many graphs > do not encode information on all observations used (e.g. -gr box- > throws out a lot of info). A -tw- graph might use information on 100 > observations but use different observations for different plots on the > same graph, so it's not clear what number(s) should be reported in > every instance. E.g. in > > sysuse auto, clear > replace pr=. if rep78==1 > replace wei=. if rep78==2 > scatter pr wei mpg > > what number of obs would you like returned? In any case, I think your > general approach will work for most cases you might care about, but I > would remind you to include weights as a qualifier (perhaps accounting > for zero, negative, and missing weights as applicable) too. > > On 10/1/07, Jesper Kjær Hansen <jkh-stata@msecon.eu> wrote: > > I think I know the answer to this one, but just to be sure: > > > > Is there any formal procedure/option/returned result for > identifying the exact number > > of observations a graph is based on, documented or > otherwise... besides first > > principles using -count- -sum- and others, that is. > > > > For example: > > > > -count if !mi(<all vars used in graph>) & [if statement | in range]- > > > > The solution works well, but sometimes I can't help > thinking that the graph command > > should return the number of observations used - just like > an estimation command. > > > > /Jesper > * * 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/

**References**:**st: Getting the exact number of obs. a graph is based on***From:*Jesper Kjær Hansen <jkh-stata@msecon.eu>

**Re: st: Getting the exact number of obs. a graph is based on***From:*"Austin Nichols" <austinnichols@gmail.com>

- Prev by Date:
**Re: st: re: generating a sequence of numbers in Mata** - Next by Date:
**st: R: Duration models: database preparation** - Previous by thread:
**Re: st: Getting the exact number of obs. a graph is based on** - Next by thread:
**st: re: calculating determinant of Hessian matrix over observations** - Index(es):

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