Question 1
(a) ANCOVA is the analysis of covariance which is used to test the effect of the independent
variable which is categorical in nature and the dependent variable which is continuous in nature. The
main difference between ANCOVA and ANOVA is the later used to test the difference of the mean of
three or more groups whereas ANCOVA is a mixture of Analysis of variance and regression
(b)
(i) False. For each level of the independent variable, there is a linear relationship between the
dependent variable and the covariate
(ii) True
(c) The exam scores (y) against current grade of a student (x) using different plotting symbols for the
studying technique can be produced using the R code:
set.seed(10)
> data <- data.frame(technique = rep(c("A", "B", "C"), each = 30), current_grade =
runif(90, 65, 95), exam = c(runif(30, 80, 95), runif(30, 70, 95), runif(30, 70, 90)))
> data$technique <- as.factor(data$technique)
> plot(exam ~ current_grade, pch = as.character(technique), main = "current_grade vs
exam", data)
> library(ggplot2)
> ggplot(data, aes(x=current_grade, y=exam, shape=technique))+geom_point()
> library(lattice)
> print(xyplot(exam ~ current_grade | technique, data = data, type = c("r", "p")))
current_grade vs exam
95
A
A A BB A
A B B A
A B B A
A A A A
A B
90
B C C
C A A
BC A A A
A A
B A A
C AA B
85
C C B
C A
C C B
exam
CA B A
A
C C
AB A
80
C
C C
B B
B B C C
B
C C
C BB B
75
C B C
C B C
B C BC
CB C
B B C
65 70 75 80 85 90
current_grade
Figure 1(a) : Comparison of student exam scores according to the study technique used in the data,
the variables of interest are studying technique (A,B,C) used by each student
(a) ANCOVA is the analysis of covariance which is used to test the effect of the independent
variable which is categorical in nature and the dependent variable which is continuous in nature. The
main difference between ANCOVA and ANOVA is the later used to test the difference of the mean of
three or more groups whereas ANCOVA is a mixture of Analysis of variance and regression
(b)
(i) False. For each level of the independent variable, there is a linear relationship between the
dependent variable and the covariate
(ii) True
(c) The exam scores (y) against current grade of a student (x) using different plotting symbols for the
studying technique can be produced using the R code:
set.seed(10)
> data <- data.frame(technique = rep(c("A", "B", "C"), each = 30), current_grade =
runif(90, 65, 95), exam = c(runif(30, 80, 95), runif(30, 70, 95), runif(30, 70, 90)))
> data$technique <- as.factor(data$technique)
> plot(exam ~ current_grade, pch = as.character(technique), main = "current_grade vs
exam", data)
> library(ggplot2)
> ggplot(data, aes(x=current_grade, y=exam, shape=technique))+geom_point()
> library(lattice)
> print(xyplot(exam ~ current_grade | technique, data = data, type = c("r", "p")))
current_grade vs exam
95
A
A A BB A
A B B A
A B B A
A A A A
A B
90
B C C
C A A
BC A A A
A A
B A A
C AA B
85
C C B
C A
C C B
exam
CA B A
A
C C
AB A
80
C
C C
B B
B B C C
B
C C
C BB B
75
C B C
C B C
B C BC
CB C
B B C
65 70 75 80 85 90
current_grade
Figure 1(a) : Comparison of student exam scores according to the study technique used in the data,
the variables of interest are studying technique (A,B,C) used by each student