ds <- read.csv(pathtofile)STAT 516 hw 9
In this homework you will use data collected by the Developmental Dynamics Lab in the USC School of Public Health, run by Dr. Liz Will, who has kindly allowed me to participate in analyzing some of her data!
Download this data set which is a simplified version of one of her data sets: These data were collected on children with Down syndrome, some having a congenital heart defect (CHD) and some not. Of interest was whether the presence of a CHD tends to affect the developmental trajectory of children with Down syndrome.
The columns in the data set are:
- id: An identifier for the child
- CHD: An indicator of whether the child was born with a CHD (1 = yes, 0 = no)
- Age: The age of the child
- GM: Gross motor score
- FM: Fine motor score
- VR: Visual reception score
- RL: Receptive language score
- EL: Expressive language score
Consider fitting an ANCOVA model to the expressive language scores of the two groups of children—those with Down syndrome and a congenital heart defect (DS+CHD) and those with Down syndrome and no congenital heart defect (DS), using age as a covariate.
The data set can be read into R with the code below:
1.
Make a scatterplot of the expressive learning scores versus the ages of the children in the study. Use different plotting symbols for the DS+CHD and DS groups. Include a legend.
2.
Make another scatterplot as above, but overlay the least-squares line for each group of children. Use different line types and update the legend to show the line types.
3.
Perform a statistical test checking whether it is necessary to allow different slopes in the two groups. State your conclusion.
4.
Proceed assuming that the slope is the same in the two groups. Make once more a scatterplot of the expressive learning score versus age as before, but this time overlay the lines for the two groups fitted under the assumption of equal slopes. Include a legend.
5.
Check whether the assumptions of the equal-slopes ANCOVA model are satisfied.
6.
Using the equal-slopes ANCOVA model, test i) whether the age covariate contributes significantly to the variation in the expressive language scores and ii), having adjusted for age, whether there is a statistically significant difference in the mean expressive language scores of children in the DS+CHD and DS groups.
7.
Using the model with equal slopes in the two groups, report the age-adjusted means (adjusted to the mean age of all the children in the data set) along with
8.
Again using the equal-slopes model, obtain a 95% confidence interval for the difference in age-adjusted means. Give an interpretation of your interval.