ANOVAreplication (version 1.1.5)

prior.predictive.check: Prior predictive check

Description

Uses the prior predictive check to test replication for ANOVA models.

Usage

prior.predictive.check(n,posterior,statistic,obs=TRUE,F_n,
                       Amat=0L,exact=0L,difmin=0L,effectsize=FALSE,seed=0)

Arguments

n

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

posterior

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

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.

obs

logic; If FALSE, the prior predictive check does not calculate a p-value, because no observed statistic is provided. Used by the sample.size.calculator function.

F_n

The Fbar value for the new data.

Amat

a 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

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

difmin

a 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.

seed

integer; seed value. If seed==0, no seed is set.

Value

Generates a histogram of F_sim in which F_n is indicated with a vertical line. The proportion of F_sim at the right of this line constitutes the prior predictive p-value.

sumFdist

a summary of F_sim

ppp

the prior predictive p-value

F_sim

a vector with F-bar values for all simulated datasets

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, sample.size.calc, power.calc.

Examples

Run this code
# NOT RUN {
#analysis original data
data_o <- data.frame(y=ChickWeight$weight,g=ChickWeight$Diet)
post <- Gibbs.ANOVA(data_o)

#analysis new data
data_r <- data.frame(y=rnorm(660, mean(data_o$y), sd=sd(data_o$y)),g=round(runif(660,1,4)))
n.r = as.numeric(table(data_r$g))

#create matrices HR: g4>(g1,g2,g3). g4-g1>0.8, g4-g2>0.5, g4-g3>0.2
HR <- create_matrices(varnames = c("g1","g2","g3","g4"),
                      hyp = "g4-g1>0.8 & g4-g2>0.5 & g4-g3>0.2")

Amat <- HR$Amat
difmin <- HR$difmin
r.F.dif.efsz <- Fbar.dif(data_r,Amat,difmin,effectsize=TRUE)

#prior predictive check
result <- prior.predictive.check(n=n.r,posterior=post$posterior,F_n=r.F.dif.efsz,statistic="dif",
effectsize=TRUE,Amat=Amat,difmin=difmin,seed=1)

result$sumFdist #summary of the f(F_y_sim)
result$ppp      #the prior predictive p-value
# }

Run the code above in your browser using DataLab