rGPQ {AOV1R}R Documentation

Generalized pivotal quantities

Description

Simulates from the generalized pivotal quantities.

Usage

rGPQ(fit, n = 10000)

Arguments

fit

an aov1r object

n

number of simulations

Value

The simulations in a dataframe.

References

Samaradasa Weerahandi. Exact Statistical Methods for Data Analysis. Springer, New York, NY (1995). <doi:10.1007/978-1-4612-0825-9>

Examples

dat <- simAOV1R(I=20, J=5, mu=10, sigmab=1, sigmaw=1)
fit <- aov1r(y ~ group, data=dat)
nsims <- 20000
pivsims <- rGPQ(fit, nsims)
pivsims$GPQ_sigma2tot <- pivsims$GPQ_sigma2b + pivsims$GPQ_sigma2w
# Generalized confidence intervals:
lapply(pivsims, quantile, probs = c(0.025, 0.975))
# compare with the frequentist confidence intervals:
confint(fit, SDs = FALSE)
# Generalized prediction interval:
with(
  pivsims,
  quantile(rnorm(nsims, GPQ_mu, sqrt(GPQ_sigma2tot)),
           probs = c(0.025, 0.975))
)
# compare with the frequentist prediction interval:
predict(fit)

[Package AOV1R version 0.1.0 Index]