Instructions for assignment: You will need to submit two documents for this assignment. The first document is a pdf document named Assign2 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 Assign2 StNo.tex and is located in the Assignment 2 folder in the Topic 7 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 2 folder. The second document that you will need to submit is an R document named Assign2 R StNo.R which is located in the Assignment 2 folder. This document should provide the R code you used to perform all your data manipulation and analysis.
Assessment information for assignment: There are a total of 80 marks for this assignment.
The data in this assignment is stored in the file named Cognitive.csv and is located in the Assignment 2 folder in the Topic 7 section of LMS. Twenty-four subjects were selected at random and were identified as having either field-independent or field-dependent cognitive styles. The subjects read two types of words (form and colour) under three cue conditions (normal, congruent and incongruent) and the order in which the six reading tasks were carried out was randomized. The time in milliseconds for completing each reading task was recorded, on each subject. The variables of interest for Assignment 2 are:
• Subject: This is a factor variable that identifies the subject.
• Time: Measures the time in milliseconds to complete a reading task.
W : This is a fixed factor that identifies the type of word used in the reading task. It has two levels (0 = form, 1 = colour ).
Cue: This is a fixed factor that identifies the type of cue condition used in the reading task. It has three levels (1 = normal, 2 = congruent, 3 = incongruent ).
D: This is a factor (categorical) variable that identifies the cognitive style of the subject. It has 2 levels (0 = field-independent, 1 = field-dependent ).
Answer the following questions.
1 Graphical analysis
1. Use the R computer package to produce a plot of the mean Time as a function of Cue colour grouped by D. The scale of the vertical and horizontal axes of your figure should be identical to Figure 1 below. (Note that the categories of the D variable need to be represented by colours in Figure 1.) (3 marks). Do you think that there is an interaction effect between Cue and D? Explain. (3 marks).
2. Use R to compute two additional variables to your data frame in R, named C2 and C3, respectively. The variables C2 and C3 are defined as follows: (3 marks)
The variable C2 is equal to 1 if the type of cue condition used in the reading task is congruent, and 0 otherwise.
The variable C3 is equal to 1 if the type of cue condition used in the reading task is incongruent, and 0 otherwise.
2 Describing the model
The researchers in the study set up the following linear mixed model to analyze their research questions.
Timeti = β0 + β1 Wti + β2 C2ti + β3 C3ti + β4 Di + β5 Wti × C2ti
+ β6 Wti × C3i + β7 Wti × Di + β8 C2ti × Di + β9 C3ti × Di
+ µ0i + µ1i Wti + εti, (1)
where Timeti is the time in milliseconds to complete a reading task for subject i (i = 1, . . . , 24) at occasion t (t = 1, . . . , 6),
• Wti = 1 if the type of word used in the reading task for subject i at occasion t is colour, and 0 otherwise,
C2ti = 1 if type of cue condition used in the reading task for subject i at occasion t is congruent, and 0 otherwise.
C3ti = 1 if type of cue condition used in the reading task for subject i at occasion t is incongruent, and 0 otherwise.
• Di = 1 if the cognitive style of subject i is field-dependent, and 0 otherwise,
• β0 is the fixed intercept,
• β1, β2, β3 and β4 are the the fixed simple effects of W , C2, C3 and D respectively,
• β5, β6, β7, β8 and β9 are the fixed two-way interaction effects of W ×C2, W ×C3, W ×D, C2 ×D and C3 × D respectively,
• µ0i is the random intercept specific to subject i,
• µ1i is the random effect of W on Time specific to subject i,
• εti is the random error associated with measuring Time at occasion t, for subject i.
• For model (1), the researchers choose an unstructured structure for the variance-covariance matrix of the random effect vector, µi. That is, the variance-covariance matrix of the random effect vector, µi, is
ñ ô
D = θ0 θ01 ,
θ01 θ1
– where θ0 and θ1 denotes the variance of the random effects µ0i and µ1i, respectively,
– θ01 denotes the covariance between the random effects µ0i and µ1i.
• Also for model (1), the researchers choose the following structure for the variance-covariance matrix of the random error vector, εi,
– where τ1 = V ar(ε1i) = V ar(ε2i) = V ar(ε3i) and τ2 = V ar(ε4i) = V ar(ε5i) = V ar(ε6i).
3. The researchers would like to express model (1) in matrix form, Yi = Xi β + Zi µi + εi, where Yi represents the response vector for subject i, Xi represents a matrix, for subject i, that contains the values of the predictors associated with the fixed effects of model (1), β is the fixed effect vector, Zi is a matrix, for subject i, that contains the values of the predictors associated with the random effects of model (1), µi is the random effect vector for subject i and εi is the random error vector for subject i. Answer the following questions.
(a) Write down the response vector, Yi, of model (1), for subject i. (1 mark)
(b) Write down the matrix, Xi, of model (1), for subject i. (7 marks)
(c) Write down the fixed effect vector, β, of model (1). (1 mark)
(d) Write down the matrix, Zi, of model (1), for subject i. (3 marks)
(e) Write down the random effect vector, µi, of model (1), for subject i. (1 mark)
(f) Write down the random error vector, εi, of model (1), for subject i. (1 mark)
(g) For model (1), derive the variance-covariance matrix of the response vector, Yi, for subject i. Show all workings. (8 marks)
3 Testing for random effects
4. The researchers would like to test whether the random effect of W should be included in model (1). They decide to test, at the 5% significance level, the null hypothesis H0 : θ1 = 0 vs the alternative hypothesis H1 : θ1 > 0 using the REML-based likelihood ratio test p-value.
(a) Write down the reference model for this test. (1 mark)
(b) Write down the nested model for this test. (1 mark)
(c) Use the R computer package to perform this test. What is the p-value for this test? (1 mark)
(d) Which model would you choose (reference or nested) to continue your analysis? Explain. (2 marks)
4 Variance-covariance estimates of the final linear mixed model
As their final linear mixed model the researchers choose model (1) which has variance-covariance matrices,
D and Ri, defined in section 2. Use this model to answer the questions in this section and in section 5.
5. Use the R computer package to calculate the estimate of the D matrix of the final linear mixed model. Present this estimate below. (2 marks)
6. Use the R computer package to calculate the estimate of the Ri matrix of the final linear mixed model. Present this estimate below. (2 marks)
7. Use your solutions for questions 3(g), 5 and 6 to calculate the estimate of the variance-covariance matrix of the response vector of the final linear mixed model. Show all your workings. (6 marks)
5 Fixed effect estimates of the final linear mixed model
8. Use the R computer package to produce a table that lists the estimates of the fixed effects in the final linear mixed model, together with their corresponding standard errors, degrees of freedom, observed test statistics and p-values. Present this table below. (2 marks)
9. Interpret the estimates of β0, β4 and β6. (9 marks)
10. Let ν = β9 β8. Use the R computer package to calculate the estimate of ν. Write this estimate below and interpret it. Also, use the R computer package to calculate the p-value for testing the null hypothesis ν = 0 versus the alternative hypothesis ν /= 0. Write this p-value below. Is there sufficient statistical evidence, at the 5% level of significance, to suggest that ν /= 0. Explain. (9 marks)
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme