|
|
|
||||
|
|
|||||
This chapter uses data set pupcross.ws.
Figure 7.1 on page 126.
First of all, we need to create a variable of constant 1. Let's call it const. We can create it through Generate vector in Data manipulation. We pick variable c9 which is unused and rename it to be const.
As mentioned in the book, the third level is just a computational device and conceptually, we have only a 2-level model. The third level is declared therefore by the variable const. Let's now set up the equations.

After clicking on the "done" button, we have the following model:

We will add the constant term in the model:


The rest of the model set up is done most efficiently through Command interface. The command to set up our model is
setx 'const' 3 'sschool' c101-c130 c20
rcon c20
Here SETX is a command used in cross classified models. The variable const is random at level 3 across categories specified by variable sschool. The dummy variables for all the categories of sschool are stored in c101-c130. The last column c20 is to store the constraints. The fixed coefficients of these dummy variables are excluded from the model, but their slopes are allowed to vary at the third level. Moreover, the covariances between these dummy variables are set to be zero and the variances are set to be equal. The last step is to activate the constraints by command rcon c20. After running these two commands, we are ready to run our model.
The result is
Table 7.1 on page 127:
Part 1: This is Figure 7.1.
Part 2: The variable pupsex and pupses are added as fixed effect.
The result is:
Part 3: The variables pdenom and sdenom are added as fixed effects.
The result is:
Part 4: The variable pupses is included as random effect.
The result is:
Table 7.2 on page 133 using socsflat.ws.
Part 1: Intercept only.
We first create a variable cons of constant 1. We need to set up a four level model as follows. Level 3 will be the "dummy" level using variable receiver. After clicking on done, we add the intercept to the model. The rest of the model setup will be most efficiently done through Command interface.
At Command interface, we type the following commands. The first command below set up the third level using variable receiver and store constraints in variable c50. The second one activates the constraints.
setx 'cons' 3 'receiver' c20-c30 c50 rcon c50
After this two commands, we see our Equations window becomes
To see more details of our model, click on the plus sign. Now we are ready to run the model.
The result is:
Part 2: Variables agesend, sexsend, agerec, sexrec, and grsize are included as fixed effects.
The result is:
Part 3: The variable sexsend is included as a random effect across group level.
The result is:
Part 4: The interaction term xsex between sexsend and sexrec is included as fixed effect.
->CALCulate "xsex"="sexsend"*"sexrec"
The result is:
Figure 7.3. on page 135.
1) Generating the predicted values:
2) Plot the predicted values against sexrec grouped by sexsend.
UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services