levenetestClust {htestClust} | R Documentation |
Reweighted Levene's Test for Homogeneity of Variance in Clustered Data
Description
Performs a reweighted test for homogeneity of marginal variances across intra-cluster groups in clustered data. Appropriate for clustered data with cluster- or group size informativeness.
Usage
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 |
center |
The name of a function to compute the center of each group. If |
trim |
optional numeric argument taking values [0, 0.5] to specify the percentage trimmed mean.
Ignored if |
formula |
a formula of the form |
data |
an optional matrix or data frame containing variables in the 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 |
Details
The null hypothesis is that all levels of group
have equal marginal variances.
Value
A list with class "htest
" containing the following components:
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
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)