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

RE: st: Different Results for the same estimation

From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   RE: st: Different Results for the same estimation
Date   Tue, 15 Sep 2009 20:25:54 +0200


So there are three nesting levels? Within counties, there are diseases
afflicting individuals? If that is the case, you should amend your command

- bysort County disease (individual): keep if _n==1-

to make it stable for the -glm- analysis. "individual" should be replaced by
some identifier variable, like an id number. 

Also look at -egen, tag()- as -drop-ping is not generally the best approach
to conducting a restricted analysis ("How are you going to get the dropped
obs back when you need them quickly?").

Also look at -xtmixed- and its brothers, as your analysis sounds like a good
case for them...


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Johannes Schoder
Sent: Dienstag, 15. September 2009 20:17
To: [email protected]
Subject: Re: st: Different Results for the same estimation

I found the bug:

Since I am using the following command before the estimation:
bysort County disease: keep if _n==1
Stata probably kicks out different obervations eacht time.
Does someone knows how to avoid that? A similar question was posed a 
couple of days ago:
How to delete duplicate observations,  Martin recommended the following 
command that I used (see above):

bysort ID: keep if_n==1

However my problem is not exactly the same:
Since I would like to aggregate my individual level data to the county 
level I would like to just keep one observation for each county [instead 
of keeping one observation per county I would like to keep 98 
observations per county (one observation per county and per cancer type; 
there are 98 different cancer types)].
Therefore the observations I would like to drop are not the same 
individuals, they just live in the same county and suffer from the same 

Thanks for your help!!

Johannes Schoder schrieb:
> Dear Statalist users:
> When I am estimating the same model several times afterwards (with the 
> same computer):
> xi: glm [dep. var.] [indep. var.]  i.county i.year, family (binomial 
> weight) link(logit)
> I get different results for the exactly same specification.
> Does anyone know whats going on here? Is it because of the different 
> number of iterations (sometimes 8,9 or 10)?
> Which results are right? What can I do to get the identical result for 
> the same estimation?
> Thanks a lot for any suggestion!
> Johannes
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

*   For searches and help try:

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