Highlights
Instructions for assignment: Please use the latest version of R (Version 4.3.3) and RStudio (Version 2023.12.1-402) to complete this assignment. You will need to submit two documents for this assignment. The first document is a pdf document named Assign StNo.pdf which will provide all your analysis and solutions for this assignment. To produce this pdf document you will need to use LaTeX. The LaTeX document which was used to produce this assignment is named Assign StNo.tex and is located in the Assignment folder in the Assessments section of LMS. You can use LaTeX online via Overleaf which is a website dedicated to producing documents from LaTeX. To use LaTeX, follow the instructions in the Overleaf.pdf document located in the Assignment folder. The second document that you will need to submit is an R document named Assign R StNo.R which is located in the Assignment folder. This document should provide the R code you used to perform all your data manipulation and analysis.
Description of assignment: The data in this assignment is stored in the file named Cognitive.csv and is located in the Assignment folder in the Assessments section of LMS. Twelve adults were randomly selected from each of the Black, Hispanic and White populations. The adults read two types of words (Form and Colour) under two cue conditions (Normal and Congruent) and the order in which the four reading tasks were carried out was randomized. The time in milliseconds for completing each reading task was recorded, on each adult. The variables of interest for this Assignment are:
W : This is a fixed factor (categorical variable) that identifies the type of word used in the reading task. It has two levels (0 = Form , 1 = Colour ).
C : This is a fixed factor (categorical variable) that identifies the type of cue condition used in the reading task. It has two levels (0 = Normal , 1 = Congruent ).
R 2: This is a fixed factor (categorical variable) that identifies whether the adult is Hispanic or not. It has 2 levels (0 = Not-Hispanic , 1 = Hispanic ).
R 3: This is a fixed factor (categorical variable) that identifies whether the adult is White or not. It has 2 levels (0 = Not-White , 1 = White )
Race : This is a fixed factor (categorical variable) that identifies the race of the adult. It has 3 levels (B = Black , H = Hispanic , W = White ).
1. Graphical analysis
1. Use the R computer package to produce a plot of the mean T as a function of W , grouped by C and Race . The scale of the vertical and horizontal axes of your figure should be identical to Figure 1 below. (Note that the categories of the C variable need to be represented by colours in Figure 1 and the categories of the Race variable need to be represented by the panels in Figure 1). Do you think that the three-way interaction effect between W , C and Race should be included in the linear mixed model? Explain.
2. Describing the model
The researchers in the study set up the following linear mixed model to analyze their research questions.
T ti = β 0 + β 1 W ti + β 2 C ti + β 3 R 2 i + β 4 R 3 i
+ β 5 W ti × C ti + β 6 W ti × R 2 i + β 7 W ti × R 3 i + β 8 C ti × R 2 i + β 9 C ti × R 3 i
+ β 10 W ti × C ti × R 2 i + β 11 W ti × C ti × R 3 i
+ µ 0 i + µ 1 i C ti + ε ti , (1)
where T ti is the time in milliseconds to complete a reading task for adult i ( i = 1 , . . . , 36) at occasion t ( t = 1 , 2 , 3 , 4) W ti = 1 if the type of word used in the reading task for adult i at occasion t is Colour , and 0 otherwise, C ti = 1 if the type of cue condition used in the reading task for adult i at occasion t is Congruent , and 0 otherwise.
2. The researchers would like to express model (1) in matrix form, Y i = X i β + Z i µ i + ε i , where Y i represents the response vector for adult i , X i represents a matrix, for adult i , that contains the values of the predictors associated with the fixed effects of model (1), β is the fixed effect vector, Z i is a matrix, for adult i , that contains the values of the predictors associated with the random effects of model (1), µ i is the random effect vector for adult i and ε i is the random error vector for adult i . Answer the following
3. Diagnostics of the final linear mixed model
Use model (1) as the final linear mixed model to answer the questions in this section and in sections 4 and 5.
3. Use the R computer package to produce a figure that checks the agreement between the predicted marginal values of T (that come from fitting model (1) to the data) and the observed mean values of T , as a function of W , grouped by C and Race . The scale of the vertical and horizontal axes of your figure should be identical to Figure 2 below. (Note that the categories of the C variable need to be represented by colours in Figure 2 and the categories of the Race variable need to be represented by the panels in Figure 2)
4 . Variance-covariance estimates of the final linear mixed model
4. Use the R computer package to calculate the estimate of the D matrix of the final linear mixed model. Present this estimate below. Make sure you round each element in the matrix to 2 decimal places.
5. Use the R computer package to calculate the estimate of the R matrix of the final linear mixed model. Present this estimate below. Make sure you round each element in the matrix to 2 decimal places.
6. Use your solutions for questions 2(g), 4 and 5 to calculate the estimate of the variance-covariance matrix of the response vector of the final linear mixed Show all your workings.
5. Fixed effect estimates of the final linear mixed model
7. Use the R computer package to produce a table that lists the estimates of the fixed effects in model (1), together with their corresponding standard errors, degrees of freedom, observed test statistics and p -values. Present this table below and make sure you round each value in the table to 2 decimal
8. Interpret the estimates of β 0 , β 2 and β 7 .
9. Let η 1 denote the mean time to complete a reading task for White adults where the word is Form and cue condition is Congruent and let η 2 denote the mean time to complete a reading task for Hispanic adults where the word is Colour and cue condition is Normal . Also let η = η 1 η 2 . Use the glht command in R to calculate the estimate of η . Write down this estimate. Do you think, at the 5% level of significance, there is sufficient statistical evidence to suggest that η 1 = η 2 ? Explain by referring to the p -value you computed in this
10. Let ω 1 denote the difference in mean time to complete a reading task between Congruent and Normal cue conditions for White adults and Colour words, and let ω 2 denote the difference in mean time to complete a reading task between Congruent and Normal cue conditions for Hispanic adults and Colour Also let ω = ω 1 ω 2 . Use the glht command in R to calculate the estimate of ω . Write down this estimate. Do you think, at the 5% level of significance, there is sufficient statistical evidence to suggest that ω 1 / = ω 2 ? Explain by referring to the p -value you computed in this question.
11. Calculate by hand the marginal residual for adult i = 14 (that is for the Adult that is identified by number 14), when the type of word is Colour and the cue condition is Congruent . Show all your ( Note: To answer this question, you will need to use the fixed effect estimates you computed in question 7 and the raw data presented in the Cognitive.csv file).
12. Figure 3 presents the random effect predictions of the final linear mixed model, for the first 5 adults in the These predictions were obtained by using the ranef() command in R. Calculate by hand the conditional residual for adult i = 2 (that is for the Adult that is identified by number 2), when the type of word is Form and the cue condition is Congruent . Show all your workings. ( Note: To answer this question, you will need to use the appropriate information presented in Figure 3, the fixed effect estimates you computed in question 7 and the raw data presented in the Cognitive.csv file).
7. Testing for random effects
13. The researchers would like to test whether the random effect of C should be included in model (1). They decide to test, at the 5% significance level, the null hypothesis H 0 : τ 1 = 0 vs the alternative hypothesis H 1 : τ 1 > 0 using the REML-based likelihood ratio test p -value.
8. Testing for fixed effects
14. The researchers would like to test whether the three-way interaction effects should be included in the model you chose in question 13 part (d) of section They decide to test, at the 5% significance level, the null hypothesis H 0 : β 10 = β 11 = 0 vs the alternative hypothesis H 1 : β 10 ML-based likelihood ratio test p -value.
15. The researchers would like to test whether the two-way interaction effects should be included in the model you chose in question 14 part (d) of section They decide to test, at the 5% significance level,the null hypothesis H 0 : β 5 = β 6 = β 7 = β 8 = β 9 = 0 vs the alternative hypothesis H 1 : β 5 0 or β 7 / = 0 or β 8 = / 0 or β 9 = / 0 using the ML-based likelihood ratio test p -value.
This STA5ARM - Mathematics has been solved by our PhD Experts at My Uni Paper.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.