Date: Mon, 21 Mar 2005 05:52:14 -0800 Dale McLerran "SAS(r) Discussion" DomainKeys? See http://antispam.yahoo.com/domainkeys Dale McLerran Re: Bivariate count model regression using SAS To: wormpai 6667 text/plain; charset=us-ascii

--- wormpai <wormpai@HOTMAIL.COM> wrote: > Hi, > > I have a dataset consisting of two dependent variables y1 and y2 > (which > could be correlated) and a set of independent variables X1 to Xn. My > model (based on my thoery) is as follows: > y1 = alpha1 + b1x1 + b2X2 + b3X5 + b4 Xn > y2=alpha1 +b21X1 + b22X3 + b23X4 + b24X5 + B25Xn-1 > So basically there are some X variables that are expected to affect > both y1 and y2 and some which only affect one of them. I want to run > a > simultaneous bivariate regression owing to the expected correlation > between the two. Does anyone have any ideas on how I can do this ? > > The y variables are count variables, so I would like to model them as > a > negative binomial or poisson variable. > > Many thanks in advance, > Seema >

Seema,

You can use the procedure NLMIXED to fit your model but you should first construct your data so that you have a single response Y and an indicator whether the response is Y1 or Y2. You also need to attach a variable which indicates the respondent from whom the observations are obtained. That is, you would first need to run code such as:

data long; set wide; ID = _n_; y=y1; Y_indic=1; output; y=y2; Y_indic=2; output; run;

Now, with the data in the long structure obtained from the above operation, you can fit a random intercept Poisson or negative binomial regression model. If there is a positive correlation between y1 and y2, then the variance of the random intercept term will be positive. Note, though, that a random intercept model would not allow y1 and y2 to be negatively correlated.

So, assuming a positive correlation and Poisson distribution, you could fit your model through the following code:

proc nlmixed data=long; if y_indic=1 then eta = alpha1 + b1*x1 + b2*X2 + b3*X5 + ... + u; else eta = alpha1 +b21*X1 + b22*X3 + b23*X4 + ... + u; mu = exp(eta); model y ~ poisson(mu); random u ~ normal(0, exp(2*logSDu)) subject=id; run;

For the negative binomial distribution, you will have to work a bit harder and specify the negative binomial likelihood structure. The code below is untested (actually, all the code presented is untested, but there is just more opportunity for misspecification of the following code than for code presented above).

proc nlmixed data=long; if y_indic=1 then eta = alpha1 + b1*x1 + b2*X2 + b3*X5 + ... + u; else eta = alpha1 +b21*X1 + b22*X3 + b23*X4 + ... + u; mu = exp(eta); kinv=1/k; loglike = lgamma(y+kinv) + lgamma(kinv) + lgamma(1+y) + y*(log(k) + eta) - (y+kinv)*log(1 + k*mu); model y ~ general(loglike); random u ~ normal(0, exp(2*logSDu)) subject=id; run;

I trust that you are familiar with the parameterization of the negative binomial distribution and recognize the parameter k as the negative binomial overdispersion parameter.

HTH,

Dale

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

__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

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