Chapter Contents 
Previous 
Next 
The NLMIXED Procedure 
data inhaler; input clarity group time freq; gt = group*time; sub = floor((_n_+1)/2); datalines; 1 0 0 59 1 0 1 59 1 0 0 35 2 0 1 35 1 0 0 3 3 0 1 3 1 0 0 2 4 0 1 2 2 0 0 11 1 0 1 11 2 0 0 27 2 0 1 27 2 0 0 2 3 0 1 2 2 0 0 1 4 0 1 1 4 0 0 1 1 0 1 1 4 0 0 1 2 0 1 1 1 1 0 63 1 1 1 63 1 1 0 13 2 1 1 13 2 1 0 40 1 1 1 40 2 1 0 15 2 1 1 15 3 1 0 7 1 1 1 7 3 1 0 2 2 1 1 2 3 1 0 1 3 1 1 1 4 1 0 2 1 1 1 2 4 1 0 1 3 1 1 1 run;
The response measurement, CLARITY, is the patients' assessment on the clarity of the leaflet instructions for the devices. The CLARITY variable is on an ordinal scale, with 1=easy, 2=only clear after rereading, 3=not very clear, and 4=confusing. The GROUP variable indicates the treatment group and the TIME variable indicates the time of measurement. The FREQ variable indicates the number of patients with exactly the same responses. A variable GT is created to indicate a group by time interaction, and a variable SUB is created to indicate patients.
As in the previous example and in Hedeker and Gibbons (1994), assume an underlying latent continuous variable, here with the form
Instead of observing y_{ij}, though, you observe only whether it falls in one of the four intervals: , (0,I1), (I1,I1+I2), or , where I1 and I2 are both positive. The resulting category is the value assigned to the CLARITY variable.
The following code sets up and fits this ordinal probit model:
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 z = probnorm(eta); else if (clarity=2) then z = probnorm(i1eta)  probnorm(eta); else if (clarity=3) then z = probnorm(i1+i2eta)  probnorm(i1eta); else z = 1  probnorm(i1+i2eta); if (z > 1e8) then ll = log(z); 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;
The PROC statement specifies the input data set and requests correlations both for the parameter estimates (CORR option) and the additional estimates specified with ESTIMATE statements (ECORR option).
The parameters as defined in the PARMS statement are as follows. B0 (overall intercept), B1 (group main effect), B2 (time main effect), B3 (group by time interaction), SD (standard deviation of the random effect), I1 (increment between first and second thresholds), and I2 (increment between second and third thresholds). The BOUNDS statement restricts I1 and I2 to be positive.
The SAS programming statements begin by defining the linear predictor ETA, which is a linear combination of the B parameters and a single random effect U. The next statements define the ordinal likelihood according to the CLARITY variable, ETA, and the increment variables. An error trap is included in case the likelihood becomes too small.
A general log likelihood specification is used in the MODEL statement, and the RANDOM statement defines the random effect U to have standard deviation SD and subject variable SUB. The REPLICATE statement indicates that data for each subject should be replicated according to the FREQ variable.
The ESTIMATE statements specify the second and third thresholds in terms of the increment variables (the first threshold is assumed to equal zero for model identifiability). Also computed is the intraclass correlation.
The output is as follows.






Chapter Contents 
Previous 
Next 
Top 
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.