LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2010, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 3 Jun 2010 17:20:19 -0700
Reply-To:     Dale McLerran <stringplayer_2@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Dale McLerran <stringplayer_2@YAHOO.COM>
Subject:      Re: NLMIXED vs GLIMMIXED
In-Reply-To:  <492516.43220.qm@web37507.mail.mud.yahoo.com>
Content-Type: text/plain; charset=iso-8859-1

I don't recall seeing any statement regarding which variable(s) you want to treat as having random slopes. I will assume you want a random slope for DRUG.

That would lead to code like the following:

/* ZIP model with random intercepts and slopes */ proc nlmixed data=zip; parms bp_0 - bp_6 0 bll_0 - bll_6 0 log_sdu1 - log_sdu4 -2 /* log(sd(u{i})) */ z1 z2 0 /* Fisher z-score values for */ /* non-zero correlations */ /* between random effects */ ;

/* Linear function for zero probability model */ eta_prob = bp_0 + u1 + bp_1*mar + bp_2*income + bp_3*gender + bp_4*ethnic + bp_5*age + (bp_6 + u2)*drug; p_0 = exp(eta_prob)/(1 + exp(eta_prob));

/* Linear function for Poisson probability model */ eta_lambda = bll_0 + u3 + bll_1*mar + bll_2*income + bll_3*gender + bll_4*ethnic + bll_5*age + (bll_6 + u4)*drug; lambda = exp(eta_lambda);

/*Log Likelihood function */ if run1=0 then prob = p_0 + (1-p_0)*exp(-lambda); if run1=0 then loglike = log(prob); else loglike = log(1-p_0) + run1*log(lambda) - lambda - lgamma(run1+1);

/* Correlation of intercept and slope parameters */ rho1 = (exp(2*Z1) - 1) / (exp(2*Z1) + 1); /* zero-inflation */ rho2 = (exp(2*Z2) - 1) / (exp(2*Z2) + 1); /* Poisson */

/* fit the model */ model run1 ~ general(loglike); random u1 u2 u3 u4 ~ normal([0, 0, 0, 0], [exp(2*log_sdu1), rho1*exp(log_sdu1 + log_sdu2), 0, 0, exp(2*log_sdu2), 0, 0, exp(2*log_sdu3), rho2*exp(log_sdu3 + log_sdu4), exp(2*log_sdu4)]) subject=subject; run;

I have continued to assume that the zero-inflation random effects are uncorrelated with the Poisson model random effects. But as noted previously, this is an assumption that you might want to examine. Note that the correlations are parameterized in terms of Fisher z-scores. This will constrain the correlations to be between -1 and 1.

I'm not sure of the consequences with regard to how long the code might run when you have more than 1000 subjects along with four random effects. I'm sure that it will run for some time. But you might want to set the number of quadrature points to some fairly small number. You probably don't need more than 5 quadrature points when your integral approximation occurs over 5^4 = 625 combinations of quadrature points. You might be able to reduce this to even fewer than 5. But 5 is probably a pretty safe number of quadrature points.

Dale

--------------------------------------- Dale McLerran Fred Hutchinson Cancer Research Center mailto: dmclerra@NO_SPAMfhcrc.org Ph: (206) 667-2926 Fax: (206) 667-5977 ---------------------------------------

--- On Thu, 6/3/10, oslo <hokut1@YAHOO.COM> wrote:

> From: oslo <hokut1@YAHOO.COM> > Subject: Re: NLMIXED vs GLIMMIXED > To: SAS-L@LISTSERV.UGA.EDU > Date: Thursday, June 3, 2010, 2:23 PM > Dear Dale; > > Thanks for writing. I sincerely apologize for all confusing > I caused. > > 1) In my first post, I copied my codes from SAS editor > and sent to you without checking that how they were appear. > After having your first response I figured out it looks > terrible. Problem was completely because of copy-past > action. I am so sorry. > 2) I have added Z2 and Z4 because I thought that a > coefficient matrix should be pertained the random slopes to > the dependent variables. Obnoxiously I was wrong. > > 3) NOW to make picture clear I need to run multilevel ZIP > with random intercept and slope. > > My input variables are. > input run1 mar income gender > ethnic age drug run rep subject; > > HERE: > ----Run is dependent variable > ----mar income gender > ethnic age drug ARE COVARIATES. HERE AGE AND > DRUG ASSUMED TO BE CONTINUES VARIABLES. > > RYAN PROGRAM WORKS VERY WELL HOWEVER I NEED TO INCLUDE > RANDOM SLOPE ALSO (WITHOUT assuming that the average slope > coefficient is 0). > > BEST REGARDS, > > Robert >


Back to: Top of message | Previous page | Main SAS-L page