Title: | Inference in the Balanced One-Way ANOVA Model with Random Factor |
---|---|
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>. |
Authors: | Stéphane Laurent |
Maintainer: | Stéphane Laurent <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0 |
Built: | 2024-11-22 03:35:41 UTC |
Source: | https://github.com/cran/AOV1R |
Fits a one-way random effect ANOVA model.
aov1r(formula, data = NULL) ## S3 method for class 'aov1r' summary(object, ...) ## S3 method for class 'summary.aov1r' print(x, ...)
aov1r(formula, data = NULL) ## S3 method for class 'aov1r' summary(object, ...) ## S3 method for class 'summary.aov1r' print(x, ...)
formula |
a formula of the form |
data |
optional dataframe |
object |
an |
... |
ignored |
x |
output of |
aov1r
returns an object of class aov1r
;
dat <- simAOV1R(I=2, J=3, mu=10, sigmab=1, sigmaw=1) fit <- aov1r(y ~ group, data=dat) summary(fit)
dat <- simAOV1R(I=2, J=3, mu=10, sigmab=1, sigmaw=1) fit <- aov1r(y ~ group, data=dat) summary(fit)
Confidence intervals for the one-way random effect ANOVA.
## S3 method for class 'aov1r' confint(object, parm, level = 0.95, SDs = TRUE, ...) ## S3 method for class 'confint.aov1r' print(x, ...)
## S3 method for class 'aov1r' confint(object, parm, level = 0.95, SDs = TRUE, ...) ## S3 method for class 'confint.aov1r' print(x, ...)
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 |
A dataframe providing the bounds of the confidence intervals.
Richard K. Burdick, Franklin. A. Graybill. Confidence Intervals on Variance Components. CRC Press; 1st edition (1992). ISBN-13: 978-0824786441.
dat <- simAOV1R(I=2, J=3, mu=10, sigmab=1, sigmaw=1) fit <- aov1r(y ~ group, data=dat) confint(fit)
dat <- simAOV1R(I=2, J=3, mu=10, sigmab=1, sigmaw=1) fit <- aov1r(y ~ group, data=dat) confint(fit)
The dataset used in Krishnammorthy & Mathew's example 4.1.
data(KM41)
data(KM41)
A data frame with 25 rows and 2 columns.
Krishnamoorthy and Mathew, Statistical Tolerance Regions, Wiley 2009.
data(KM41) str(KM41) table(KM41$Batch)
data(KM41) str(KM41) table(KM41$Batch)
Prediction interval for the one-way random effect ANOVA model, based on a Satterthwaite approximation of the degrees of freedom.
## S3 method for class 'aov1r' predict(object, level = 0.95, ...)
## S3 method for class 'aov1r' predict(object, level = 0.95, ...)
object |
an output of |
level |
confidence level |
... |
ignored |
A vector of length two, the bounds of the prediction interval.
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>
dat <- simAOV1R(I=2, J=3, mu=10, sigmab=1, sigmaw=1) fit <- aov1r(y ~ group, data=dat) predict(fit)
dat <- simAOV1R(I=2, J=3, mu=10, sigmab=1, sigmaw=1) fit <- aov1r(y ~ group, data=dat) predict(fit)
Simulates from the generalized pivotal quantities.
rGPQ(fit, n = 10000)
rGPQ(fit, n = 10000)
fit |
an |
n |
number of simulations |
The simulations in a dataframe.
Samaradasa Weerahandi. Exact Statistical Methods for Data Analysis. Springer, New York, NY (1995). <doi:10.1007/978-1-4612-0825-9>
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)
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)
Simulates a balanced one-way random effect ANOVA model.
simAOV1R(I, J, mu, sigmab, sigmaw)
simAOV1R(I, J, mu, sigmab, sigmaw)
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 |
A dataframe.
simAOV1R(I=2, J=3, mu=10, sigmab=1, sigmaw=1)
simAOV1R(I=2, J=3, mu=10, sigmab=1, sigmaw=1)