The 'infection' data is created directly within the SAS script using a DATALINES block. It includes the variables clinic, t, x, and n, representing information from a clinical trial.
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block creates the 'infection' dataset using embedded raw data (DATALINES). Each row represents an observation with the variables clinic (clinic identifier), t (treatment), x (number of successes), and n (total number of trials).
Explanation : This PROC NLMIXED procedure fits a logistic mixed-effects model to the 'infection' data.
- `parms` initializes the model parameters: `beta0` (intercept), `beta1` (effect of treatment 't'), and `s2u` (variance of the random effect).
- `eta`, `expeta`, and `p` define the linear predictor part (`eta`) and the probability of success (`p`) according to a logistic model.
- `model x ~ binomial(n,p)` specifies that the variable `x` (number of successes) follows a binomial distribution with `n` trials and probability `p`.
- `random u ~ normal(0,s2u) subject=clinic` introduces a random effect `u` for each `clinic`, assumed to follow a normal distribution with a mean of 0 and variance `s2u`. This allows modeling heterogeneity between clinics.
- `predict eta out=eta` calculates and outputs the predicted values for `eta`.
- `estimate '1/beta1' 1/beta1` requests an estimate of the inverse of the `beta1` parameter.
Copied!
proc nlmixed data=infection;
parms beta0=-1 beta1=1 s2u=2;
eta = beta0 + beta1*t + u;
expeta = exp(eta);
p = expeta/(1+expeta);
model x ~ binomial(n,p);
random u ~ normal(0,s2u) subject=clinic;
predict eta out=eta;
estimate '1/beta1' 1/beta1;
run;
1
PROC NLMIXEDDATA=infection;
2
parms beta0=-1 beta1=1 s2u=2;
3
eta = beta0 + beta1*t + u;
4
expeta = exp(eta);
5
p = expeta/(1+expeta);
6
model x ~ binomial(n,p);
7
random u ~ normal(0,s2u) subject=clinic;
8
predict eta out=eta;
9
estimate '1/beta1'1/beta1;
10
RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.