Statalist


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

Re: st: Different Results for the same estimation


From   Johannes Schoder <johannes.schoder@soi.uzh.ch>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Different Results for the same estimation
Date   Tue, 15 Sep 2009 16:16:03 -0400

Hi Martin:
Thanks a lot for your help.
Yes you are right I have nesting levels, within counties there are diseases that afflict individuals. Unfortunately I messed (or the data provider) something up when importing the data. I just realized that I have a lot of individuals with the same identifier variable (although they are not the same), so I can't really use the id number. Is there any alternative of aggregating the individual level data to the county level?
Johannes


Martin Weiss schrieb:
<>


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

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


HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Johannes Schoder
Sent: Dienstag, 15. September 2009 20:17
To: statalist@hsphsun2.harvard.edu
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 disease.

Thanks for your help!!
Johannes






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:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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