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]

st: Problem with ci_marg_mu with nominal dependent variable


From   Solveig Hillesund <[email protected]>
To   [email protected]
Subject   st: Problem with ci_marg_mu with nominal dependent variable
Date   Fri, 11 Oct 2013 08:22:06 +0200

Problem with ci_marg_mu with nominal dependent variable

I am attempting to make figures with confidence intervals around
predicted probabilities for a two-level multinominal logistic
regression model with a random intercept. The problem is creating the
confidence intervals.

If y was my dependent variable (with categories  0, 1, 2 and 3), x and
z my independent variables and g the grouping variable, I would create
the figure with predicted probabilities for x (when z=0) like this
(following an version of the description in Rabe-Hesketh and Skrondal
(2012: 673-676) adapted to population-averaged expectation with the mu
marginal option):

gllamm y x z, i(g) lin(mlogit) family(binom) base(1) from(a) skip adapt

save temp, replace

drop _all

set obs 50

generate x = -2 + _n*0.005  /*to fit range of original x*/



generate set = 3000 + _n

expand 4



by set, sort: generate y=_n



generate z=0

recode z (4=0)



replace p0607d=.

append using temp



generate preddata = p0607d ==.



gllapred probs0, mu marginal fsample outcome(0)

gllapred probs1, mu marginal fsample outcome(1)

gllapred probs2, mu marginal fsample outcome(2)

gllapred probs3, mu marginal fsample outcome(3)



twoway (line probs2 z_HI_ostby, sort lpatt(solid)) (line probs3
z_HI_ostby, sort lpatt(longdash)) (line probs0 z_HI_ostby, sort
lpatt(shortdash)) (line probs1 z_HI_ostby, sort lpatt(dash)) if
preddata==1



According to Skrondal “Approximate confidence intervals for predicted
marginal expectations can be obtained by simulating parameters from
their estimated asymptotic sampling distribution” (Skrondal and Rabe
Hesketh 2009:16). More specifically, “To produce the confidence bands,
we randomly drew 1000 parameter vectors from a multivariate normal
distribution with mean vector ˆϑ and covariance matrix côv(ϑ), the
estimated asymptotic sampling distribution of the estimates. For each
randomly drawn parameter vector ϑk, k=1, . . . , 1000, we computed the
predicted marginal mean μ-k.(x0 j ) for each school and then
identified the 25th- and 976th-largest values for each school.”
(Skrondal and Rabe Hesketh 2009:17-18).



I have tried to use ci_marg_mu to accomplish this, but run into
problems. First, the fsample option is not allowed (so not sure
whether full sample or only estimation sample will be used). Second,
because of the nominal dependent variable Stata tells me I need to
“specify outcome() option if data is not in expanded form”, but when I
specify outcome I get the error “outcome() option not allowed”. I
guess it might work to use expanded data, but I am having some
problems specifying the model in this form, so I am hoping there is
some other way to get around the problem. According to a powerpoint
presentation I have found, written by the author of the program, the
operation is supposed to work with nominal data.





References:

Rabe-Hesketh, S., & Skrondal, A. (2012). Multilevel and longitudinal
modeling using Stata. Categorical responses, counts, and survival.
(Third ed. Vol. 2). College Station, Tex.: Stata Press

Skrondal, A. and S. Rabe-Hesketh (2009). “Prediction in multilevel
generalized linear models”. In J.R. Statst. Soc. A. 172(3).

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index