Type: | Package |
Title: | Inference in the Balanced One-Way ANOVA Model with Random Factor |
Version: | 0.1.0 |
Author: | Stéphane Laurent |
Maintainer: | Stéphane Laurent <laurent_step@outlook.fr> |
Description: | Provides functions to perform statistical inference in the balanced one-way ANOVA model with a random factor: confidence intervals, prediction interval, and Weerahandi generalized pivotal quantities. References: Burdick & Graybill (1992, ISBN-13: 978-0824786441); Weerahandi (1995) <doi:10.1007/978-1-4612-0825-9>; Lin & Liao (2008) <doi:10.1016/j.jspi.2008.01.001>. |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R (≥ 2.10) |
Imports: | cellranger, purrr, stats, data.table, lazyeval, utils |
RoxygenNote: | 7.1.1 |
Suggests: | knitr, rmarkdown |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2020-11-05 08:52:16 UTC; stla |
Repository: | CRAN |
Date/Publication: | 2020-11-10 10:00:08 UTC |
Krishnamoorthy & Mathew's example 4.1
Description
The dataset used in Krishnammorthy & Mathew's example 4.1.
Usage
data(KM41)
Format
A data frame with 25 rows and 2 columns.
References
Krishnamoorthy and Mathew, Statistical Tolerance Regions, Wiley 2009.
Examples
data(KM41)
str(KM41)
table(KM41$Batch)
One-way random effect ANOVA
Description
Fits a one-way random effect ANOVA model.
Usage
aov1r(formula, data = NULL)
## S3 method for class 'aov1r'
summary(object, ...)
## S3 method for class 'summary.aov1r'
print(x, ...)
Arguments
formula |
a formula of the form |
data |
optional dataframe |
object |
an |
... |
ignored |
x |
output of |
Value
aov1r
returns an object of class aov1r
;
Examples
dat <- simAOV1R(I=2, J=3, mu=10, sigmab=1, sigmaw=1)
fit <- aov1r(y ~ group, data=dat)
summary(fit)
Confidence intervals
Description
Confidence intervals for the one-way random effect ANOVA.
Usage
## S3 method for class 'aov1r'
confint(object, parm, level = 0.95, SDs = TRUE, ...)
## S3 method for class 'confint.aov1r'
print(x, ...)
Arguments
object |
an output of |
parm |
ignored |
level |
confidence level |
SDs |
logical, whether to return confidence intervals about the standard deviations or about the variances |
... |
ignored |
x |
an output of |
Value
A dataframe providing the bounds of the confidence intervals.
References
Richard K. Burdick, Franklin. A. Graybill. Confidence Intervals on Variance Components. CRC Press; 1st edition (1992). ISBN-13: 978-0824786441.
Examples
dat <- simAOV1R(I=2, J=3, mu=10, sigmab=1, sigmaw=1)
fit <- aov1r(y ~ group, data=dat)
confint(fit)
Prediction interval for one-way random effect ANOVA
Description
Prediction interval for the one-way random effect ANOVA model, based on a Satterthwaite approximation of the degrees of freedom.
Usage
## S3 method for class 'aov1r'
predict(object, level = 0.95, ...)
Arguments
object |
an output of |
level |
confidence level |
... |
ignored |
Value
A vector of length two, the bounds of the prediction interval.
References
T. Y. Lin, C. T. Liao. Prediction intervals for general balanced linear random models. Journal of Statistical Planning and Inference 138 (2008), 3164 – 3175. <doi:10.1016/j.jspi.2008.01.001>
Examples
dat <- simAOV1R(I=2, J=3, mu=10, sigmab=1, sigmaw=1)
fit <- aov1r(y ~ group, data=dat)
predict(fit)
Generalized pivotal quantities
Description
Simulates from the generalized pivotal quantities.
Usage
rGPQ(fit, n = 10000)
Arguments
fit |
an |
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)
Simulation of one-way random effect ANOVA
Description
Simulates a balanced one-way random effect ANOVA model.
Usage
simAOV1R(I, J, mu, sigmab, sigmaw)
Arguments
I |
integer, number of groups |
J |
integer, number of replicates per group |
mu |
numeric, overall mean |
sigmab |
positive number, the between standard deviation |
sigmaw |
positive number, the within standard deviation |
Value
A dataframe.
Examples
simAOV1R(I=2, J=3, mu=10, sigmab=1, sigmaw=1)