Performs a permutation test of differences in means between two groups of censored data.

cenperm2(y1, y2, grp, R = 9999, alternative = "two.sided", printstat = TRUE)

## Arguments

y1 The column of data values plus detection limits The column of indicators, where 1 (or TRUE) indicates a detection limit in the y1 column, and 0 (or FALSE) indicates a detected value in y1. Grouping or factor variable. Can be either a text or numeric value indicating the group assignment. The number of permutations used. Default is 9999 indicates the alternative hypothesis and must be one of "two.sided", "greater" or "less". You may also specify just the initial letter. Default is "two.sided". Logical TRUE/FALSE option of whether to print the resulting statistics in the console window, or not. Default is TRUE.

## Value

Permutation test results with the number of permutations, range in group means and their difference, and range in p-value.

## Details

Because this is a permutation test it avoids the problem with MLE tests (cen2means) that assume a normal distribution. No values are modeled as below zero and p-values are trustworthy. Ranges in means and p-values are due to interval-censoring of censored data means.

## References

Good, P., 2000. Permutation Tests: A Practical Guide to Resampling Methods for Testing Hypotheses, 2nd ed, Springer Series in Statistics. Springer-Verlag, New York, NY. doi: 10.1007/978-1-4757-3235-1

Helsel, D.R., 2011. Statistics for Censored Environmental Data using Minitab and R, 2nd ed. John Wiley & Sons, USA, N.J.

Shapiro, S.S., Francia, R.S., 1972. An approximate analysis of variance test for normality. Journal of the American Statistical Association 67, 215–216.

## Examples

data(PbHeron)
cenperm2(PbHeron$Liver,PbHeron$LiverCen,PbHeron$DosageGroup,alternative="t") #> Permutation test of mean CensData: PbHeron$Liver   by Factor: PbHeron\$DosageGroup
#>      9999 Permutations     alternative = two.sided
#>   mean of High = 9.288 to 9.288     mean of Low = 0.1093 to 0.1207
#>      Mean (High - Low) =  9.179 to 9.167       p = 0.0013 to 0.0014
#>