![drop observations in stata drop observations in stata](https://img.yumpu.com/26645570/1/500x640/bootstrap-stata.jpg)
But it has decreased from 347 to 286 as a result of eliminating the 13 observations with a value of -2. The difference between the coefficients for religious attendance is still significantly different. A two group t-test confirms there is not a significant difference between the means of the two groups. Stata uses “.” (the period) for missing data. We’ll change the observations with -2 for MCS to missing. These observations need to be treated as missing data. It’s not possible for the mental composite score to be negative. Something that looks odd is the “minimum” value of negative 2. The difference in means between the two groups is 139, much smaller than the difference in the coefficients in model 3 and model 3a of 347.
![drop observations in stata drop observations in stata](https://mdl.library.utoronto.ca/sites/default/public/06.png)
Let’s check out the summary table for MCS subdivided by whether the observation is in model 4 (not_in_model4). People who don’t report their income level have an average 347 point lower mental health composite score than those who report their income. Quietly reg MCS2000 UnemployedWksPastCal2000cont NumberBioStepAdoptChildHH2000 i.Mar_Status high_rel_attend if not_in_model4 =0 Quietly reg MCS2000 UnemployedWksPastCal2000cont NumberBioStepAdoptChildHH2000 i.Mar_Status high_rel_attend if not_in_model4 =1 I then ran model 3 using the observations not in model 4 (named model_3d) and using the observations used in model 4 (named model_3e). Replace not_in_model4=0 if in_model_3=1 & in_model_4=1 I made the variable equal zero if the observation is used in both model 3 and model 4. Gen not_in_model4 =1 if in_model_3=1 & in_model_4=0 I then created another variable that equals one if the observation is used in model 3 but not in model 4. To examine the differences between the two samples I ran model 3 once more and generated a new variable “in_model_3”. Is there a big difference between the 1,683 observations used in model 4 and the 384 observations that were not used in model 4 but were used in model 3? So a person who does not report their income level is included in model_3 but not in model_4. (This is knows as listwise deletion or complete case analysis). Note: regression analysis in Stata drops all observations that have a missing value for any one of the variables used in the model. Using the same 1,683 observations in model 3a that we used in model 4 had a significant impact on the coefficient of the religious attendance variable for model 3. When we controlled for income we noticed that our sample size decreased from 2,067 to 1,683. If we didn’t control for income we might conclude that frequent religious attendance leads to a lower mental health composite score. The coefficient for the variable “frequent religious attendance” was negative 58 in model 3 and then rose to a positive 6 in model 4 when income was included. Using different samples in our models could lead to erroneous conclusions when interpreting results.īut excluding observations can also result in inaccurate results.
#Drop observations in stata how to#
)/Contents(See "instructions" on the MC3 course page.In a previous post, Using the Same Sample for Different Models in Stata, we examined how to use the same sample when comparing regression models. See "instructions" on the MC3 course page.