Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: adjusted twoway table


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: adjusted twoway table
Date   Fri, 19 Aug 2011 15:05:49 +0200

On Fri, Aug 19, 2011 at 1:54 PM, Lima, Julie <[email protected]> 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.

You can get a nicer looking table this way:
*--------------- 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)
reshape long pr , i(marst) j(occ)
label value occ occ
tabdisp occ marst, cellvar(pr)

restore
*------------- 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index