levenetestClust: Reweighted Levene's Test for Homogeneity of Variance in...

Description Usage Arguments Details Value References Examples

View source: R/levenetestClust.R

Description

Performs a reweighted test for homogeneity of marginal variances across intra-cluster groups in clustered data. Reweighted to correct for potential cluster- or group size informativness.

Usage

1
2
3
4
5
6
7
levenetestClust(y, ...)

## Default S3 method:
levenetestClust(y, group, id, center = c("median", "mean"), trim = NA, ...)

## S3 method for class 'formula'
levenetestClust(formula, id, data, subset, na.action, ...)

Arguments

y

vector of numeric responses.

...

further arguments to be passed to or from methods.

group

vector or factor object defining groups.

id

vector or factor object denoting cluster membership for y reponses.

center

The name of a function to compute the center of each group. If mean, the reweighted group means will be used. The default median is the suggested measure of center, as it provides a more robust test.

trim

optional numeric argument taking values [0, 0.5] to specify the percentage trimmed mean. Ignored if center = median.

formula

a formula of the form lhs ~ rhs where lhs is a numeric variable giving the data values and rhs a factor with two or more levels giving the corresponding groups.

data

an optional matrix or data frame containing variables in the formula formula and id. By default the variables are taken from environment(formula).

subset

an optional vector specifying a subset of observations to be used.

na.action

a function which indicates what should happen when data contain NAs. Defaults to getOption("na.action").

Details

The null hypothesis is that all levels of group have equal marginal variances.

Value

A list with class "htest" containing the following compoments:

statistic

the value of the test statistic.

p.value

the p-value of the test.

parameter

the degrees of freedom of the chi square distribution.

method

a character string indicating the test performed.

data.name

a character string giving the name of the data and the total number of clusters.

M

the number of clusters.

References

Gregg, M., Marginal methods and software for clustered data with cluster- and group-size informativeness. PhD dissertation, University of Louisville, 2020.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(screen8)

## Do boys and girls have the same variability in math scores?
## Test using vectors
levenetestClust(y=screen8$math, group=screen8$gender, id=screen8$sch.id)

## Test using formula method
levenetestClust(math~gender, id=sch.id, data=screen8)

## Using 10% trimmed mean
levenetestClust(math~gender, id=sch.id, data=screen8, center="mean", trim=.1)

megregg/htestClust documentation built on June 23, 2020, 12:07 a.m.