Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: adjusted twoway table


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: adjusted twoway table
Date   Fri, 19 Aug 2011 14:41:27 +0200

On Fri, Aug 19, 2011 at 1:54 PM, Lima, Julie <julie_lima@brown.edu> wrote:
> Yes -- I'm using mlogit with caregiver arragement as dependent
> variable, the primary caregiver variable as dummies in the model
> (ref=wife) and then a slew of covariates.

*---------------- begin example ------------------
// prepare some data
// caregiver arrangement = occ
// primary caregiver = marst
sysuse nlsw88, clear
gen occ = cond(occupation < 3, 1 ,     ///
          cond(occupation < 7, 2, 3 )) ///
          if !missing(occupation)
label define occ 1 "higher" ///
                 2 "middle" ///
                 3 "lower"
label value occ occ		

gen marst = married + 2* never_married
label define marst 0 "divorced/widowed" ///
                   1 "married"          ///
                   2 "never married"		
label value marst marst

// estimate model
mlogit occ i.marst grade i.race

// fix values of explanatory variables
preserve  // so we can later recover original data
replace grade = 12 // finished highschool
replace race = 1   // white

// predict probability
predict pr* if e(sample), pr

// expected count is sum of probabilities
collapse (sum) pr* if e(sample), by(marst)
rename pr1 higher
rename pr2 middle
rename pr3 lower
list

restore // get original data back
*---------------- end example ---------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------
*
*   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   |   Site index