ANOVAreplication (version 1.1.5)

power.calc: Power Calculator

Description

Calculates the power for the prior predictive check

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

vector; the population values the alternative distribution. To calculate the power to reject replication if the means are equal 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. The create_matrices function can be used to obtain Amat.

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. The create_matrices function can be used to obtain difmin. Default = 0L, indicating that only the ordering of means is evaluated.

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, create_matrices, 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 <- rep(mean(data_o$y),3)
#compute pooled sd
sd.g <- aggregate(data_o$y,by=list(data_o$g),sd)[,2]
n.g <- table(data_o$g)
p.sd<- pooled.sd(data_o)

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

post <- Gibbs.ANOVA(data_o)

power.calc(n.r=c(20,21,22,23),posterior=post$posterior,g.m=g.m,p.sd=p.sd,
           statistic="exact",exact=means,alpha=.05)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab