ANOVAreplication (version 1.1.3)

power.calc: Power Calculator

Description

Calculates the power for the prior predictive check against equal means

Usage

power.calc(n.r,posterior,g.m,p.sd,statistic,Amat=0L,exact=0L,difmin=0L,effectsize=FALSE,
           alpha=.05)

Arguments

n.r

vector with the sample size per group (i.e., n_jr) for new study (i.e., y_r).

posterior

matrix (e.g., the output of Gibbs.ANOVA) with samples from the posterior based on the original data (i.e., y_o).

g.m

integer; the population value for the equal means in the alternative distribution. We advice to specify the grand mean of the study variables in the original dataset.

p.sd

integer; the population value for the pooled standard deviation in the alternative distribution. We advice to specify the pooled standard deviation for the study variables in the original dataset.

statistic

the type of hypothesis to be evaluated: "ineq" for inequality constrained means, "dif" for inequality constraints plus minimum differences between means, "exact" for specific values for the means.

Amat

p by q matrix, where p is the number of means in the ANOVA model, and q is the number of constraints to be imposed on the model. Each row represents one constraint where the parameter with the lower value according to the constraint receives the value -1, and the parameter with the higher value according to the constraint receives the value 1. Other parameters within the same row obtain the value 0.

exact

vector of length p, where p is the number of means in the ANOVA model, with the exact values of the constrained hypothesis.

difmin

vector of length q with the minimum difference per constraint as specified in Amat.

effectsize

logical; If TRUE the values in difmin are interpreted as Cohen's d.

alpha

integer; the level of alpha that should be taken into account while calculating the required sample size.

Value

power

The acquired power given the input

rejection.value

The 1-alpha'th percentile of the null distribution. The proportion of H1 larger than this value constitues power.

References

Zondervan-Zwijnenburg, M.A.J., Van de Schoot, R., & Hoijtink, H. (2017). Testing ANOVA replication by means of the prior predictive p-value.

See Also

See also runShiny, Gibbs.ANOVA, Fbar.ineq, Fbar.dif, and Fbar.exact, prior.predictive.check, sample.size.calc.

Examples

Run this code
# NOT RUN {
#analysis original data
data_o <- data.frame(y=ChickWeight$weight,g=ChickWeight$Diet)
g.m <- mean(data_o$y)
#compute pooled sd
sd.g <- aggregate(data_o$y,by=list(data_o$g),sd)[,2]
n.g <- table(data_o$g)
p.sd <- ((n.g[1]-1)*sd.g[1]+(n.g[2]-1)*sd.g[2]+(n.g[3]-1)*sd.g[3]+(n.g[4]-1)*sd.g[4])/(sum(n.g)-4)

means <- aggregate(data_o$y,by=list(data_o$g),mean)[,2]

Gibbs.ANOVA(data_o,it=200,burnin=50) #we advise >1000 iterations, >500 burnin for reliable results

power.calc(n.r=c(20,21,22,23),posterior=output_m,g.m=g.m,p.sd=p.sd,
           statistic="exact",exact=means,alpha=.05)

# }

Run the code above in your browser using DataCamp Workspace