Computes (2^k-1) censored regression models and their AIC statistics. Prints out the lowest AIC models and the terms used.
bestaic(y.var, cen.var, x.vars, LOG = TRUE, n.models = 10)
The column of y (response variable) values plus detection limits.
The column of indicators, where 1 (or
TRUE) indicates a detection limit in the
y.var column, and 0 (or
FALSE) indicates a detected value is in
One or more uncensored explanatory variable(s). See Details
Indicator of whether to compute the regression in the original y units, or on their logarithms. The default is to use the logarithms (
LOG = TRUE). To compute in original units, specify the option
LOG = FALSE (or
LOG = 0).
The number of models with their AIC values to be printed in the console window. All (2^k-1) models are computed internally. This sets how many "best" (lowest AIC) models have output printed to the console.
Prints number of
x.vars and AIC values.
x.vars: If 1 x variable only, enter its name. If multiple x variables, enter the name of a data frame of columns of the x variables. No extra columns unused in the regression allowed. Create this by
x.frame <- data.frame (Temp, Flow, Time) for 3 variables (temperature, flow and time).
AIC of each model is printed from lowest to highest AIC to help evaluate the ‘best’ regression model. n.models determines how many lines of model info is printed.
LOG: The default is that the Y variable will be log transformed (LOG = TRUE).
Helsel, D.R., 2011. Statistics for censored environmental data using Minitab and R, 2nd ed. John Wiley & Sons, USA, N.J.
data(Brumbaugh) # Multiple regression bestaic(Brumbaugh$Hg, Brumbaugh$HgCen, Brumbaugh[, c("SedMeHg","PctWetland", "SedAVS")]) #> Evaluating 7 models and printing the 10 lowest AIC models #> n.xvars model.xvars aic #> 3 SedMeHg PctWetland SedAVS 328.8393 #> 2 PctWetland SedAVS 330.3570 #> 2 SedMeHg PctWetland 331.9899 #> 1 PctWetland 332.3166 #> 2 SedMeHg SedAVS 334.6676 #> 1 SedMeHg 338.2900 #> 1 SedAVS 344.0416 #> <NA> <NA> NA #> <NA> <NA> NA #> <NA> <NA> NA