permTestAnova: Permutation test for ANOVA F-test

View source: R/permTestAnova.R

permTestAnovaR Documentation

Permutation test for ANOVA F-test

Description

Permutation test to see if the population mean is the same for two or more populations. For instance, test latex where latex denotes the population mean. The values of the numeric variable are randomly assigned to the groups and the ANOVA F statistic is calculated. The command will print the mean and standard error of the distribution of the test statistic as well as a P-value.

Usage

permTestAnova(x, ...)

## Default S3 method:
permTestAnova(
  x,
  group,
  B = 9999,
  plot.hist = TRUE,
  plot.qq = FALSE,
  xlab = NULL,
  ylab = NULL,
  title = NULL,
  seed = NULL,
  ...
)

## S3 method for class 'formula'
permTestAnova(formula, data = parent.frame(), subset, ...)

Arguments

x

a numeric vector.

...

further arguments to be passed to or from methods.

group

a factor variable with two or more levels. If group is a numeric vector, it will be coerced into a factor variable.

B

the number of resamples (positive integer greater than 2).

plot.hist

a logical value. If TRUE, the permutation distribution of the statistic is plotted.

plot.qq

a logical value. If TRUE, then a normal quantile-quantile plot of the resampled test statistic is created.

xlab

an optional character string for the x-axis label

ylab

an optional character string for the y-axis label

title

an optional character string giving the plot title

seed

optional argument to set.seed

formula

a formula of the form y ~ group where y is numeric and group is a factor variable.

data

a data frame with the variables in the formula.

subset

an optional expression specifying which observations to keep.

Details

Observations with missing values are removed.

Value

Returns invisibly a vector of the replicates of the test statistic.

Methods (by class)

  • permTestAnova(default): Permutation test for ANOVA F-test

  • permTestAnova(formula): Permutation test for ANOVA F-test

Author(s)

Adam Loy, Laura Chihara

References

Tim Hesteberg's website: https://www.timhesterberg.net/bootstrap-and-resampling

Examples


permTestAnova(states03$ViolentCrime, states03$Region, B = 499)

#using formula syntax
## Not run: 
permTestAnova(ViolentCrime ~ Region, data = states03, B = 9999)

## End(Not run)


CarletonStats documentation built on Aug. 22, 2023, 5:06 p.m.