hnm workbook · 2014-05-15 · as an extension of the work completed by the hierarchical linear...
TRANSCRIPT
HNM Workbook:
An Introduction to Hierarchical Nonlinear Modeling – Bernoulli Analysis
Workbook Written by: Greg Rousell Support: Dr. Barnabas Emenogu
Page 1
Table of Contents
1. Data Preparation ………….…………………………………………………………………………………………………………… 2
2. Developing the Null Model ….………………………………………………………………………………………………….… 2
3. Reading the Null Model Output ……………………………………………………………………………………………….. 4
4. Adding a Predictor to Level 1 …………………………………………………………………………………….…….…..…… 5
5. Determining the Impact of Level 1 Variables ……………………………………………………………………………. 6
6. Adding a Predictor to Level 2 …………………………………………………………………………………………………… 7
7. Determining the Impact of Level 2 Variables ………………………………………………………………………….… 8
References ……………………………………………………………………………………………………………………………………… 9
Page 2
As an extension of the work completed by the Hierarchical Linear Models (HLM) Learning and Research Community, the HLM v.6.06 software by Raudenbush, Bryk and Congdon also allows for the analysis of nonlinear variables. Binary outcomes (i.e. 1 or 0) follow the Bernoulli distribution, the proportion of cases scoring 1 will be between .01 and .99. This type of analysis allows for the calculation of the probability of an event occurring. For example, whether not a student achieves the provincial standard on an assessment (1) or fails to achieve the provincial standard (0).
1. Data Preparation As with HLM, the first step in the analysis is the preparation of the data. In this example Grade 6 EQAO result were used as the Dependent Variables. Prior to loading the data into the HLM software the Reading, Writing and Math scores were converted to binary variables. Students who had no data were omitted from the analysis. Students who achieved Level 3 or 4 were coded as 1 (Achieved the provincial standard), all other scores, including those who were exempt from the assessment, were coded as 0 (Did not achieve the provincial standard). For a more detailed description of preparing and loading data into the HLM software see Conley (2007).
2. Developing a Null Model a. The HLM software defaults to a linear
analysis. To change the type of analysis, click on Outcome.
b. This brings up the Basic Model Specifications
menu. Click on Bernoulli (0 or 1).
Page 3
c. Select the outcome variable. In this case R_PROVST is
a binary variable where 1 = the student met the provincial standard in Reading, and 0 = the student did not meet the provincial standard.
d. Once an Outcome variable is selected a
Null Model is created. This model explains the probability of the event occurring for all cases. There is nothing to explain the probabilities for different groups.
e. Click on “Run Analysis” f. Click on “Run the model shown”
A window will pop up each time you run a model. This window shows the activity associated with the analysis. When the window closes, the output is ready to view.
Page 4
g. To view the output file click on “File”
h. Click on “View Output”
3. Reading the Null Model Output The output provides estimation of fixed effects for both unit‐specific and population‐average models. For the Null Model we are interested in the Final estimation of fixed effects (Population ‐ average model with robust standard errors) Of most interest is the Coefficient. This number will allow us to calculate the probability of students to achieve the provincial standard. (See Section 5 ‘Determining the Impact of Level 1 Variables)
Page 5
4. Adding a Predictor to Level 1 Now that we know the probability of all students in achieving the provincial standard, we can start adding different variables and examine how they predict the Outcome Variable. a. Select the variable of interest. In this case
we will use “MALE”
Note: Independent variables can be either binary or continuous. As with a linear model, binary independent variables are added uncentred. Continuous variables are added centred, either group or grand centred depending on what you want to look at.
The Level 1 model has been modified to include a new Beta term (β1) to include MALE. The Level 2 model has also been modified to include the Beta‐1 (β1) term. b. Click on “Run Analysis” c. Click on “Run the model shown”
The activity window will briefly pop up and then close when the analysis is complete.
Page 6
5. Determining the Impact of Level 1 Variables In the case of a Bernoulli outcome we need to exponentiate the coefficients (Taylor, 2000) to determine the impact of how many times more likely a student is to achieve the provincial standard. a. Click on “File” b. Click on “View Output” c. Scroll to the bottom of the output to
the “Final estimation of fixed effects (Population‐average model with robust standard errors)” table.
The output provided a Coefficient for the Intercept and for MALE. We can see from the P‐value column that MALE is a significant predictor for achieving the provincial standard. The Coefficient and T‐ratio are both negative indicating that this variable reduces the chance of achieving the provincial standard. The Odds Ratio tells us that being MALE reduces the odds of achieving at the provincial standard by 0.49:1. If the Odds Ratio is above 1 then there is an increase in the odds of achieving at the provincial standard. An equation is used to calculate the probabilities of males and females achieving the provincial standard. The coefficients for a particular case measure the difference in logarithm of the odds of achieving the provincial standard, when all other variables are held constant (Gebotys, 2000).
P (Achieving Provincial Standard) = Where e is the base of natural logarithms (approximately 2.72) and c is the coefficient. As in linear regression the impact of the variable is the Intercept + Slope. In this case it is 1.431333 + (‐0.720729) = 0.710604. For males, the equation becomes:
P (Achieving Provincial Standard) = . .
= 0.671, or 67.1%.
This means that males have a 67.1% chance of achieving the provincial standard.
Page 7
To compare to females, the Intercept is used (recall that males were codes as ‘1’ and females as ‘0’, this means that in the equation β1x now equals 0).
P (Achieving Provincial Standard) = . .
P (Achieving Provincial Standard) = 0.807, or 80.7%.
This means that females have an 80.7% chance of achieving the provincial standard. NOTE: When adding multiple variables at Level 1 beware of what the Intercept represents. For example, if students with IEP’s are added (1 = students with an IEP, 0 = students without an IEP) along with gender, the Intercept becomes Females, without IEPs. Depending on the question you are trying to answer it may be necessary to develop multiple models.
6. Adding a Predictor to Level 2 a. Click on “Level 2” button to see the Level‐2
variables.
b. Here I have added the Social Risk Index
(SRI) of the schools as a Level 2 variable. Run the new model and go to the output file: c. Click on “Run Analysis” d. Click on “Run the model shown” e. Click on “File” f. Click on “View Output” and scroll to the
Final estimation of fixed effects (Unit‐specific model with robust standard errors)
Page 8
7. Determining the Impact of Level 2 Variables The Unit‐specific output contains the random effect for Level‐2 units and should be used in situations where you are interested in the unique effects of the individual Level‐2 units (in this example, schools) The effect of the Level‐2 variable (SRI) on the slope of the intercept, G01, examines the relationship between the Level‐2 variable and the averages of students achieving the provincial standard that can be attributed to SRI. (University of Texas, 2000) In this example we see the relationship between the mean SRI of a school and probability of students achieving the provincial standard. The higher the mean SRI, the less likely students are to achieve the provincial standard. We only need to be exponentiate Level‐1 coefficients. Level‐2 coefficients are interpreted in the usual manner as Level‐2 predictors operate on the Level‐2 portion of the outcome – in this case the school means. These means will be proportions, not binary (Taylor, 2000).
Page 9
References Gebotys, R. (2000) SPSS guide for the logistic model example, output and interpretation. Retrieved May
5, 2009 from http://info.wlu.ca/~wwwpsych/gebotys/logist.pdf Taylor, R.B. (2000) Generalized linear probability models in HLM. Retrieved May 5, 2009 from
http://www.rbtaylor.net/hlml15.pdf University of Texas (2007) Getting started with HLM for Windows Section Six: The Hierarchical
Generalized Linear Model. Retrieved May 5, 2009 from http://ssc.utexas.edu/consulting/tutorials/stat/hlm/#Section%206