 # Statistics & R Programming Questions

Subject Mathematics Statistics-R Programming

## Question

Coverage: Power and sample size in CRD, Randomized complete block design (Chapter 4.1), Power and sample size in RCBD

1. Recall the one-way ANOVA for Textbook problem 3.26
> summary(aov(Life ~ factor(Brand), data = prob0326))
Df Sum Sq Mean Sq F value Pr(>F)
factor(Brand) 2 1196.1 598.1 38.34 6.14e-06 *** Residuals 12 187.2 15.6
Do the following power calculation and sample size determination:
(a) For the ANOVA F test at α = .05 you did in the last homework, calculate the power of this test to detect the differences in means observed in the data. Do the power calculation both “by hand” in R and using R function power.anova.test().
Hint: a = 3 treatments, n = 5. You can use tapply(), or use fitted model to find µ1 = 95.2, µ2 = 79.4, µ3 = 100.4, and MSE = 15.6. You can view these results as close guess of µi’s and σ2. See “Chapter 3 handout on power and sample size.”
(b) Treating the experiment in this problem as a pilot study, suppose in the future theinvestigator would like to detect the above differences in means using the one-way ANOVA F test at α = .01 with power of 80%. Find the sample size necessary. You can use power.anova.test().

2. Textbook problem 4.4 and do the following
(a) Analyze the data from this experiment. That is, conduct the overall two-way ANOVA Ftest at α = .05 and draw conclusions.
1) use residual plots to check assumptions of normality and homogeneous variance.
3) Plot the interaction plot. Is it consistent with the nonadditivity test?
(c) Suppose the experimental design is mistaken to be a CRD (blocks are ignored), conductthe “incorrect” ANOVA analysis without the block factor. Comment on the results.
(d) For the RCBD (the correct fixed effects model), conduct simultaneous pairwise comparisons using Tukey HSD. State your conclusions.
(e) Calculate the relative efficiency of this RCBD vs. CRD. Interpret your result.
Does the blocking work well?
(f) Assuming the block factor as random,
1) estimate its variance σβ2 by hand;
2) fit a linear mixed model – do you obtain the same σcβ2?
3) conduct pairwise comparisons using Tukey HSD, and compare to the HSD results from the fixed effects model in (d).
(g) Viewing this RCBD experiment as a pilot study with a = 3 and σ² = MSE = 8.64. Suppose if any two treatment means differ by as much as 6, the experimenter wishes to reject H0 of no treatment effect in a two-way ANOVA F-test at α = .05 with power of at least 90%. How many days (blocks) are needed?
Hint: Here D = 6; see “Chapter 4.1 handout on power and sample size”.
(h) Suppose in the data set, the observation for Solution 3 on Day 1 is missing (e.g., y31, the 9th observation in the dataset, is replaced by ‘NA’), conduct the overall two-way ANOVA F test at α = .05 for this unbalanced data set and draw conclusions.
For example, you can change that observation using
> prob0404Copy <- prob0404
> prob0404Copy["9", "Growth"] <- NA
> prob0404Copy

3. Textbook problem 4.7 and do the following
(a) In part (a), analyze the data from this experiment. That is, conduct the overall two-way ANOVA F test at α = .05 and draw conclusions.
(c) In part (c), provide residual plots to check model assumptions.
(e) Plot the interaction plot. Is it consistent with the nonadditivity test?
(f) Calculate the relative efficiency of this RCBD vs. CRD. Interpret your result.
Does the blocking work well?
(g) Assuming the block factor as random,
1) estimate its variance σβ2 by hand;
2) fit a linear mixed model – do you obtain the same σcβ2?
3) conduct pairwise comparisons using Fisher LSD, and compare to the LSD results from the fixed effects model in (b).
(h) Suppose in the data set, the observation for Tip 4 on Coupon 4 is missing (e.g., y44, the 16th observation in the dataset, is replaced by ‘NA’), conduct the overall two-way ANOVA F test at α = .05 for this unbalanced data set and draw conclusions.
You can change that observation using
> prob0407Copy <- prob0407
> prob0407Copy["16", "Hardness"] <- NA

## Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

# 1.

fit <- aov(Life ~ factor(Brand), data=prob0326)
summary(fit)

# (a)

# By hand
ybars <- c()
a <- 3
n <- 5
MSE <- summary(fit)[]\$'Mean Sq'
alpha <- 0.05
ybars <- c(fit\$coefficients,fit\$coefficients+fit\$coefficients,fit\$coefficients+fit\$coefficients)

ncp <- n * sum( (ybars-mean(ybars))^2)/MSE
Fcritical <- qf( alpha, (a-1), (a-1)*(n-1), lower.tail=FALSE)
beta <- pf( Fcritical, a-1, (a-1)*(n-1), ncp)
power <- 1 -beta
power # = 0.999998

# Using power.anova.test()
power.anova.test(groups=a, n=n,
between.var=var(ybars),
within.var=MSE,
sig.level=alpha,
power=NULL)...

This is only a preview of the solution. Please use the purchase button to see the entire solution

## Related Homework Solutions

Statistics Questions: Time Series Analysis \$175.00
Statistics
Time Series Analysis
Estimation
Parameters
Plots
Correlogram
Residuals
Parametric Curves
Data Sets
Transformations
Equations
Differences
Forecast
Sales
Simple Proportions and Binomials \$30.00
Probability
Statistics
Mathematics
Proportions
Binomials
Factorials
Trials
Equations
Denominators
Pairwise Combinations
Optimal Strategy
R Programming
Functions
Training The Model: Malicious Websites Detection \$63.00
Mathematics
Statistics
Training
Model
Malicious Websites Detection
Regression
Calculations
Test Procedures
Classifications
KNN Method
Arguments
Functions
Data Sets
Statistics & R Programming Problems \$125.00
Statistics
R Programming
Mathematics
Data Sets
Correlation Matrix
Daily Volatility
Average Values
Samples
Stock Returns
Patterns
Management
Empirical Procedure
Tables
Graphs
Predictions
Statistics Questions \$18.00
Statistics
Data Sets
Mathematics
Linear Regression
ANOVA
Test for Normality
Functions
R Programming
Normal Distribution
Variables
Codes
P-Values
Estimation
Coefficients
Statistics Questions \$23.00
Statistics
Mathematics
Binomial Distribution
Tables
Programming Statements
Probability
Factory
Defective Products
Population Mean
Standard Deviation
Samples
Excel
Live Chats