Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Power Analysis in One-Way ANOVA: R Code and Interpretation, Assignments of Statistics

R code solutions and interpretations for various exercises related to power analysis in one-way analysis of variance (anova). It covers calculations of non-centrality parameters, significance thresholds, and power under alternative hypotheses.

Typology: Assignments

Pre 2010

Uploaded on 09/17/2009

koofers-user-oxj
koofers-user-oxj 🇺🇸

10 documents

1 / 4

Toggle sidebar

Related documents


Partial preview of the text

Download Power Analysis in One-Way ANOVA: R Code and Interpretation and more Assignments Statistics in PDF only on Docsity! 22s:158/165 Homework 7 solutions 1. (Exercise 7.2) Using R, > means=c(10,11,11) > sig.2=4 > ## Get non-centrality parameter: > alphas=means-mean(means) > ncp=6*sum(alphas^2)/sig.2 > > between.variance=sum((alphas)^2)/2 > power.anova.test(groups=3,between.var=between.variance,within.var=sig.2, sig.level=0.05,power=0.90) Balanced one-way analysis of variance power calculation groups = 3 n = 76.93183 between.var = 0.3333333 within.var = 4 sig.level = 0.05 power = 0.9 NOTE: n is number in each group So, the sample size is n=77 to get a power of at least 0.90. 2. (Exercise 7.3) > g=4 > sum.alphas.2=6 ## This is the sum of the squared treatment effects. > sig.2=3 > n=4 > N=n*g > > ## Get noncentrality parameter: > ncp=n*sum.alphas.2/sig.2 > ncp [1] 8 > > #significance threshold computed under H0 true: > cutoff=qf(0.99,g-1,N-g) > cutoff [1] 5.952545 1 > ## Find the power under HA true: > power=pf(cutoff,g-1,N-g,ncp,lower.tail=FALSE) > power [1] 0.2260942 So, the power is 0.23. 3. (Exercise 7.4) 1. FALSE. The probability of rejecting the null hypothesis when the null is false (and the alternative is true) IS the power, and this is 0.85. 2. FALSE. The probability of failing to reject H0 when H0 is true, is the probability of accepting H0 when it is true, and this is α, which is 0.05. 4. (Problem 7.2) > g=3 > means=c(45,32,60) > sig.2=36 > ## Get between group variance: > alphas=means-mean(means) > between.variance=sum((alphas)^2)/(g-1) > power.anova.test(groups=g,between.var=between.variance,within.var=sig.2, sig.level=0.01,power=0.95) Balanced one-way analysis of variance power calculation groups = 3 n = 3.674063 between.var = 196.3333 within.var = 36 sig.level = 0.01 power = 0.95 NOTE: n is number in each group So, the sample size is n=4 to get a power of at least 0.95. 2
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved