Computes tests for each of the two factors and optionally for their interaction using likelihood ratio tests. p-values will not be identical to the usual method of moments ANOVA tests but will be similar.
cen2way(y1, y2, fac1, fac2, LOG = TRUE, interact = TRUE)
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
The first grouping or factor variable. Can be either a text or numeric value indicating the group assignment.
The second grouping or factor variable. Can be either a text or numeric value indicating the group assignment.
A logical variable indicating whether natural logs are to be taken of the 'y1' column data. Default is TRUE.
A logical variable indicating whether to compute an interaction term between the two variables. Default is TRUE. #' @keywords two-way two-factor factorial ANOVA analysis of variance censored
Q-Q plots of residuals. Likelihood ratio test statistics ("chisquare"), degrees of freedom ("df") and p-values (pval) for two factors and optionally the interaction. Data on the underlying models, including AIC and R2 are also provided.
Tests are computed using Maximum Likelihood Estimation. When a gaussian distribution model is used (LOG=FALSE) modeled values may fall below zero, producing unreal p-values (often lower than they should be). Because of this, testing in log units is preferable and is the default unless you are transforming the y values prior to running the function (such as taking cube roots to approximate a gamma distribution). The 'delta.lr0x2' stat output is the -2loglikehood for the test of the model versus an intercept-only model.
Helsel, D.R., 2011. Statistics for Censored Environmental Data using Minitab and R, 2nd ed. John Wiley & Sons, USA, N.J. Millard, S.P., 2013. EnvStats: An R Package for Environmental Statistics. Springer-Verlag, New York.