Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Weichle, Thomas" <Thomas.Weichle@va.gov> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: Using over() option in -margins- command |
Date | Wed, 16 Mar 2011 10:49:13 -0500 |
Hi Statalisters, Using the auto dataset, suppose I generate the following indicator variables. generate weight_gt_50ptile = 0 replace weight_gt_50ptile = 1 if weight > 3190 generate length_gt_25ptile = 0 replace length_gt_25ptile = 1 if length > 170 Then, I run the following logistic regression model. * Case A: logistic foreign i.weight_gt_50ptile i.length_gt_25ptile estimates store auto I would like to estimate average predicted probabilities using -margins-. Suppose I run margins (1) and (2) below. * (1) margins weight_gt_50ptile#length_gt_25ptile, predict(pr) * (2) estimates restore auto margins length_gt_25ptile, predict(pr) over(weight_gt_50ptile) **** Note: Results obtained from (1) are identical to (2) Suppose I run a similar model but include the variables mpg and price. * Case B: logistic foreign i.weight_gt_50ptile i.length_gt_25ptile mpg price estimates store auto2 Again, I would like to estimate average predicted probabilities using -margins-. Suppose I run margins (3) and (4) below (syntax identical to (1) and (2)). * (3) margins weight_gt_50ptile#length_gt_25ptile, predict(pr) post * (4) estimates restore auto2 margins length_gt_25ptile, predict(pr) over(weight_gt_50ptile) post **** Note: In this case, results obtained from (3) and (4) are not identical to eachother. In Case A, the margins are identical using "margins X#Y" compared to "margins Y, over(X)". In Case B, the margins are different using "margins X#Y" compared to "margins Y, over(X)". My question is the following: In Case B, why are the margins different? It appears as if the over() option is the cause for this difference but I am unable to understand its reasoning. Tom Weichle Math Statistician Center for Management of Complex Chronic Care (CMC3) Hines VA Hospital, Bldg 1, C202 708-202-8387 ext. 24261 Thomas.Weichle@va.gov * * 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/