bestaic: Find the lowest AIC multiple regression model

Description Usage Arguments Details Value References See Also Examples

Description

Computes (2^k-1) censored regression models and their AIC statistics. Prints out the lowest AIC models and the terms used.

Usage

1
bestaic(y.var, cen.var, x.vars, LOG = TRUE, n.models = 10)

Arguments

y.var

The column of y (response variable) values plus detection limits.

cen.var

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 y.var.

x.vars

One or more uncensored explanatory variable(s). See Details

LOG

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).

n.models

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.

Details

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).

Value

Prints number of x.vars, lists x.vars and AIC values.

References

Helsel, D.R., 2011. Statistics for censored environmental data using Minitab and R, 2nd ed. John Wiley & Sons, USA, N.J.

See Also

survival::survreg

Examples

1
2
3
4
data(Brumbaugh)

# Multiple regression
bestaic(Brumbaugh$Hg, Brumbaugh$HgCen, Brumbaugh[, c("SedMeHg","PctWetland", "SedAVS")])

NADA2 documentation built on April 30, 2021, 5:09 p.m.