Learn R Programming

lawstat (version 3.2)

lnested.test: Test for a monotonic trend in variances

Description

The function performs a test for a monotonic trend in variances. The test statistic is based on a combination of the finite intersection approach and the classical Levene procedure (using the group means), the modified Brown-Forsythe Levene-type procedure (using the group medians) or the modified Levene-type procedure (using the group trimmed means). More robust versions of the test using the correction factor or structural zero removal method are also available. Two options for calculating critical values, namely, approximated and bootstrapped, are available. By default, NAs from the data are omitted.

Usage

lnested.test(y, group, location = c("median", "mean", "trim.mean"), 
tail = c("right","left","both"), trim.alpha = 0.25, 
bootstrap = FALSE, num.bootstrap = 1000, 
correction.method = c("none","correction.factor","zero.removal","zero.correction"), 
correlation.method = c("pearson","kendall","spearman"))

Arguments

y

a numeric vector of data values.

group

factor of the data.

location

the default option is "median" corresponding to the robust Brown-Forsythe Levene-type procedure; "mean" corresponds to the classical Levene's procedure, and "trim.mean" corresponds to the robust Levene-type procedure using the group trimmed means.

tail

the default option is "right", corresponding to an increasing trend in variances as the one-sided alternatives; "left" corresponds to a decreasing trend in variances, and "both" corresponds to any (increasing or decreasing) monotonic trend in variances as the two-sided alternatves.

trim.alpha

the fraction (0 to 0.5) of observations to be trimmed from each end of 'x' before the mean is computed.

bootstrap

the default option is FALSE, i.e., no bootstrap; if the option is set to TRUE, the function performs the bootstrap method described in Lim and Loh (1996) for Levene's test.

num.bootstrap

number of bootstrap samples to be drawn when bootstrap is set to TRUE; the default value is 1000.

correction.method

procedures to make the ltrend test more robust; the default option is "none"; "correction.factor" applies the correction factor described by O'Brien (1978) and Keyes and Levy (1997); "zero.removal" performs the structural zero removal method by Hines and Hines (2000); "zero.correction" performs a combination of O'Brien's correction factor and the Hines-Hines structural zero removal method (Noguchi and Gel, 2009); note that the options "zero.removal" and "zero.correction" are only applicable when the location is set to "median"; otherwise, "none" is applied.

correlation.method

measures of correlation; the default option is "pearson", the usual correlation coefficient which is equivalent to the t-test; nonparametric measures of correlation such as "kendall" (Kendall's tau) or "spearman" (Spearman's rho) may also be chosen, in which case, two libraries, Hmisc and Kendall, are required.

Value

A list with the following vector components.

T

the statistic and p-value of the test based on the Tippett p-value combination.

F

the statistic and p-value of the test based on the Fisher p-value combination.

N

the statistic and p-value of the test based on the Liptak p-value combination.

L

the statistic and p-value of the test based on the Mudholkar-George p-value combination.

Each of the vector components contains the following numeric components.

statistic

the value of the test statistic expressed in terms of correlation (Pearson, Kendall, or Spearman).

p.value

the p-value of the test.

method

type of test performed.

data.name

a character string giving the name of the data.

non.bootstrap.statistic

the statistic of the test without bootstrap method.

non.bootstrap.p.value

the p-value of the test without bootstrap method.

References

Boos, D. D. and Brownie, C. (1989). Bootstrap methods for testing homogeneity of variances. Technometrics 31, 69-82.

Brown, M. B. and Forsythe, A. B. (1974). Robust tests for equality of variances. Journal of the American Statistical Association 69, 364-367.

Gastwirth, J. L., Gel, Y. R., and Miao, W. (2008). The Impact of Levene's Test of Equality of Variances on Statistical Theory and Practice. Working paper, Department of Statistics, George Washington University.

Hines, W. G. S. and Hines, R. J. O. (2000). Increased power with modified forms of the Levene (med) test for heterogeneity of variance. Biometrics 56, 451-454.

Hui, W., Gel, Y. R., and Gastwirth, J. L. (2008). lawstat: an R package for law, public policy and biostatistics. Journal of Statistical Software 28, Issue 3.

Keyes, T. K. and Levy, M. S. (1997). Analysis of Levenes test under design imbalance. Journal of Educational and Behavioral Statistics 22, 845-858.

Levene, H. (1960). Robust Tests for Equality of Variances, in Contributions to Probability and Statistics, ed. I. Olkin, Palo Alto, CA: Stanford Univ. Press.

Lim,T.-S., Loh, W.-Y. (1996) A comparison of tests of equality of variances Computational Statistical \& Data Analysis 22, 287-301.

Mudholkar, G. S., McDermott, M. P., and Mudholkar, A. (1995). Robust finite-intersection tests for homogeneity of ordered variances. Journal of Statistical Planning and Inference 43, 185-195.

Noguchi, K. and Gel, Y. R. (2009) Combination of Levene-type tests and a finite-intersection method for testing equality of variances against ordered alternatives. Working paper, Department of Statistics and Actuarial Science, University of Waterloo.

O'Brien, R. G. (1978). Robust techniques for testing heterogeneity of variance effects in factorial designs. Psychometrika 43, 327-344.

See Also

neuhauser.hothorn.test, levene.test, ltrend.test, mma.test, robust.mmm.test

Examples

Run this code
# NOT RUN {
data(pot)
lnested.test(pot[,"obs"], pot[,"type"], location="median", tail="left", 
correction.method="zero.correction")$N

##   lnested test based on the modified Brown-Forsythe Levene-type procedure using the 
##   group medians with modified structural zero removal method and correction factor 
##   (left-tailed with Pearson correlation coefficient)
##
## data:  pot[, "obs"] 
## Test Statistic (N) = 4.905, p-value = 0.0002618

lnested.test(pot[,"obs"], pot[,"type"], location="median", tail="left", 
correction.method="zero.correction",bootstrap=TRUE,num.bootstrap=500)$N

##   bootstrap lnested test based on the modified Brown-Forsythe Levene-type procedure 
##   using the group medians with modified structural zero removal method and correction 
##   factor (left-tailed with Pearson correlation coefficient)
##
## data:  pot[, "obs"] 
## Test Statistic (N) = 4.9936, p-value = 0.000207

# }

Run the code above in your browser using DataLab