Description Usage Arguments Value Author(s) References See Also Examples
View source: R/prior.predictive.check.R
Uses the prior predictive check to test replication for ANOVA models.
1 2 | prior.predictive.check(n,posterior,statistic,obs=TRUE,F_n,
Amat=0L,exact=0L,difmin=0L,effectsize=FALSE,seed=0)
|
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 |
effectsize |
logical; If TRUE the values in |
seed |
integer; seed value. If seed==0, no seed is set. |
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 |
M. A. J. Zondervan-Zwijnenburg
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 runShiny
, Gibbs.ANOVA
, Fbar.ineq
, Fbar.dif
, and Fbar.exact
, sample.size.calc
, power.calc
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.