Package 'AOV1R'

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

Help Index


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 y~group

data

optional dataframe

object

an aov1r object (output of an aov1r call)

...

ignored

x

output of summary

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 aov1r

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 confint applied to an aov1r object

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)

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)

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 aov1r

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 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)

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)