Programming the statistical procedures from SAS

multiple random factors in proc nlmixed - SAS 9.3

Occasional Contributor
Posts: 10

multiple random factors in proc nlmixed - SAS 9.3


   I've seen a response to this question posted by Steve Dunham but there were some aspects that were unclear and in addition I was hoping that Steve or someone could make reference to the following code:


*nlmixed model including random factor and zip;

*in reality I have two random factors - bin, which is an indicator of the longitudinal nature of the data (nested under subject ID)

*subject id (ptid) which is the arbitrary identifier within the study;

proc nlmixed data=foo.nlmixed_data;

parms b0=1.35 b1=-.023 b2=-.2466 b3=-.0115 a0=-.2027 a1=.0606 a2=.2426 a3=.0127 sigma2=.0811;

logit0 = a0 + a1*studygroup + a2*treatst + a3*age;

prob0 = 1 / (1 + exp(-logit0));

mu = exp(b0 + u + b1*studygroup + b2*treatst + b3*age);

if count = 0 then   *likelihood if no counts - zip;

    ll = log(prob0 + (1 - prob0)*exp(-mu));

else      *count > 0;

   ll = count*log(mu) + log(1 - prob0) -mu -lgamma(count + 1);

model  count ~ general(ll);

* here's where I get lost;

*for one random factor the random stmt is ;

random u ~ normal(0, sigma2) subject = bin;

* but for two its more complex;

*bins are nestedwithin subject;

*random u v ~ normal([0,0] [subject_sigma2, cov, bin_sigma2]) subject = bin; *something like this;



I really help somebody can help fill in the missing pieces.




Posts: 3,834

Re: multiple random factors in proc nlmixed - SAS 9.3

Posted in reply to OldSASGuy100

Support for multiple RANDOM statements was added to PROC NLMIXED In SAS/STAT 13.2, which was shipped with SAS 9.4m2.

SAS 9.3 (from 2011) did not support multiple RANDOM statements. 


To see examples and discussion, read Kurada (2016) "Fitting Multilevel Hierarchical Mixed Models Using PROC NLMIXED"

Occasional Contributor
Posts: 10

Re: multiple random factors in proc nlmixed - SAS 9.3

unfortunately, I don't have access to SAS 13.2, I only have 9.3.

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation