Use R for Q1-Q3
Use R to randomly assign 10 experimental units to each of three treatments (1, 2. and 3). Then simulate
responses for the 30 experimental units satisfying the one-way ANOVA model:
v f 1,2,
Git vid N(0,²)
with u = 4.7, o2 = 4, and treatment effects T1 = -3, 72 = 5, and 73 = -2. Your solution should include
your R code and a plot of the simulated values.
2. Consider the situation in Problem 1. The experimenter wants to consider a reduced model where
T1 = T2 = 73 = 0. Simulate responses for the 30 experimental units satisfying this reduced model.
Compare boxplots of simulated responses under this reduced model with boxplots of simulated responses
under the full model described in Problem 1 (where there are differences in the treatment effects).
3. Now explore what happens to data simulated from the model in Problem 1 when the error variance
increases. Try multiple values for o2 and find a value of o2 for which you cannot see any noticable
difference in the boxplota of response values from the three treatments.
4. Under the model in Problem 1, what is the distribution of Y23, the response from the 3rd experimental
unit to receive treatment 2?
5. Under the model in Problem 1, what is the distribution of
6. Under the model in Problem 1, what is the distribution of the difference between an experimental unit
receiving treatment 1 and an experimental unit receiving treatment 2?
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction
of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice.
Unethical use is strictly forbidden.
## Question 1
treatments.not.random <- c(rep(1,10), rep(2, 10), rep(3, 10))
treatment = sample(treatments.not.random)
n = length(treatment)
Exp.Unit = 1:n
CRD.table = data.frame(Exp.Unit, treatment, row.names = NULL)
mu = 4.7
s2 = 4
tau.1 = -3
tau.2 = 5
tau.3 = -2
means = rep(NA, n)
means[treatment == 1] = mu + tau.1
means[treatment == 2] = mu + tau.2
means[treatment == 3] = mu + tau.3
Y.sim = means + rnorm(n, mean = 0, sd = sqrt(s2))
SimData = data.frame(Exp.Unit, treatment, Y.sim)
boxplot(Y.sim ~ treatment, main = "Boxplot of Simulated ANOVA Data")