bartlett_test {BFpack}R Documentation

Bartlett Test of Homogeneity of Variances

Description

Performs Bartlett's test of the null that the variances in each of the groups (samples) are the same.

Usage

bartlett_test(x, g, ...)

## Default S3 method:
bartlett_test(x, g, ...)

Arguments

x

a numeric vector of data values, or a list of numeric data vectors representing the respective samples, or fitted linear model objects (inheriting from class "lm").

g

a vector or factor object giving the group for the corresponding elements of x. Ignored if x is a list.

...

further arguments to be passed to or from methods.

Details

x must be a numeric data vector, and g must be a vector or factor object of the same length as x giving the group for the corresponding elements of x.

Value

A list with class "bartlett_htest" containing the following components:

statistic

Bartlett's K-squared test statistic.

parameter

the degrees of freedom of the approximate chi-squared distribution of the test statistic.

p.value

the p-value of the test.

conf.int

a confidence interval for the mean appropriate to the specified alternative hypothesis.

method

the character string "Bartlett test of homogeneity of variances".

data.name

a character string giving the names of the data.

vars

the sample variances across groups (samples).

n

the number of observations per group (sample)

Bain t_test

In order to allow users to enjoy the functionality of bain with the familiar stats-function bartlett.test, we have had to make minor changes to the function bartlett.test.default. All rights to, and credit for, the function bartlett.test.default belong to the R Core Team, as indicated in the original license below. We make no claims to copyright and incur no liability with regard to the changes implemented in bartlett_test.

This the original copyright notice by the R core team: File src/library/stats/R/bartlett_test.R Part of the R package, https://www.R-project.org

Copyright (C) 1995-2015 The R Core Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

A copy of the GNU General Public License is available at https://www.R-project.org/Licenses/

References

Bartlett, M. S. (1937). Properties of sufficiency and statistical tests. Proceedings of the Royal Society of London Series A 160, 268–282. DOI: 10.1098/rspa.1937.0109.

Examples

require(graphics)

plot(count ~ spray, data = InsectSprays)
bartlett_test(InsectSprays$count, InsectSprays$spray)


[Package BFpack version 1.2.3 Index]