Assignment 07
EXTENDING THE MIXED-EFFECT REGRESSION MODEL
This goal of this assignment is to give you more experience working with mixed-effects regression models to analyze longitudinal data. In this assignment, you will again use the data from the file nhl.csv to examine longitudinal variation in cost of attending an NHL game.
Instructions
Submit either your QMD and HTML file or, if you are not using Quarto, a PDF file of your responses to the following questions. Please adhere to the following guidelines for further formatting your assignment:
- All graphics should be resized so that they do not take up more room than necessary and should have an appropriate caption.
- Any typed mathematics (equations, matrices, vectors, etc.) should be appropriately typeset within the document using Markdown’s equation typesetting.
- All syntax should be hidden (i.e., not displayed) unless specifically asked for.
- Any messages or warnings produced (e.g., from loading packages) should also be hidden.
This assignment is worth 12 points.
Preparation
After importing the data set, create a new variable called c_year
that centers the year
values at 2002. This variable will represent the number of years since 2002. For all analyses in this assignment, unless otherwise requested, use the c_year
variable and not the year
variable.
Data Exploration
Create and report a plot to display the cost of attending an NHL game (FCI) over time facetted on whether or not high school hockey is a tradition in the team’s location. This plot should include the average and team profiles for each facet. Make the teams’ profiles slightly transparent so that the mean profile is easily visible.
Do the teams’ profiles indicate that a random-effect of linear growth should be included in the candidate models? Explain.
Based on the plot created in Question #1, indicate whether models that include an effect of high school hockey tradition should be included in the candidate set of models. If this effect should be included, does the data suggest a main-effect or an interaction-effect with time? Explain. (2pts)
Fitting and Evaluating Models
Fit the following five models:
- Model A: Unconditional random intercepts model
- Model B: Unconditional growth model (with only intercept random-effect)
- Model C: Unconditional growth model (with both intercept and linear growth random-effects)
- Model D: Conditional growth model with main-effect of high school hockey (with both intercept and linear growth random-effects)
- Model E: Conditional growth model with interaction-effect between high school hockey and time (with both intercept and linear growth random-effects)
Use maximum likelihood estimation to fit all the models.
- Create and report a table of regression results. In this table Include the following information for each of the five candidate models (5pts):
- Estimated fixed-effect coefficients and standard errors;
- Estimated variance components;
- Model-level deviance and AICc measures; and
- Any notes necessary to help the reader
Most Empirically Supported Model
Based on the AICc values use the model with the most empirical evidence to answer the remaining questions.
Write the multilevel equations for the statistical model (not the fitted equations) for the model with the most empirical evidence. Don’t forget to include the assumptions!
Write the team-specific fitted equation for the Minnesota Wild based on the model that has the most empirical evidence.
Use the results from the fitted model with the most empirical evidence to create a plot that displays the predicted average cost of attending an NHL game as a function of time for teams that have a tradition of high school and those that do not.
Add a line to the plot you created in Question #7 (don’t re-create the plot) showing the predicted cost of attending a Minnesota Wild game.
Write a caption for your plot (3–4 sentences) that help a reader understand the effect of time and high school hockey tradition on cost of attending an NHL game and also how the cost of attending a Wild game compares to the average team over time. (2pts)