Contributor
Posts: 45

# Can I use a covariate in NLMIXED

Hi,

To add a covariate to NLMIXED, is this as simple as to add to a GLIMMIX model for example?

Thanks,

Marcio

Frequent Contributor
Posts: 140

## Re: Can I use a covariate in NLMIXED

Nothing in NLMIXED is as simple as it is in GLIMMIX.  However, the NLMIXED documentation provides examples of models with covariates. See e.g. SAS/STAT(R) 9.2 User's Guide, Second Edition  where they give this code for a model with several covariates:

proc nlmixed data=inhaler corr ecorr;

parms b0=0 b1=0 b2=0 b3=0 sd=1 i1=1 i2=1;

bounds i1 > 0, i2 > 0;

eta = b0 + b1*group + b2*time + b3*gt + u;

if (clarity=1) then p = probnorm(-eta);

else if (clarity=2) then

p = probnorm(i1-eta) - probnorm(-eta);

else if (clarity=3) then

p = probnorm(i1+i2-eta) - probnorm(i1-eta);

else p = 1 - probnorm(i1+i2-eta);

if (p > 1e-8) then ll = log(p);

else ll = -1e100;

model clarity ~ general(ll);

random u ~ normal(0,sd*sd) subject=sub;

replicate freq;

estimate 'thresh2' i1;

estimate 'thresh3' i1 + i2;

estimate 'icc' sd*sd/(1+sd*sd);

run;

Discussion stats