stepwise.ss: Spatial scale forward stepwise regression

Description Usage Arguments Details Value Author(s) References Examples

View source: R/stepwise.ss.R

Description

This function fits a spatial scale (SS) forward stepwise regression model.

Usage

1
stepwise.ss(y, X.3D, y.name, ss, epsilon, verbose=TRUE)

Arguments

y

A numeric response vector

X.3D

A 3-D or stacked array of numeric variables, where each stack represents a particular level of covariates (i.e., individual- and area-level variables at more than one spatial scale). In cases where values are only present for a covariate at certain levels, that covariate is assigned missing values at all other levels.

y.name

A name for y

ss

A vector of names to identify the different levels of covariates available as potential candidates for model input

epsilon

A positive value used as a stopping criterion when there is inadequate improvement in the model's performance. The algorithm stops if the difference in the Akaike information criterion (AIC) between the current model and the proposed model is less than epsilon.

verbose

If TRUE, details are printed as the algorithm progresses

Details

This function estimates coefficients using the SS forward stepwise regression approach. The function also estimates the model fit and provides summary details.

Value

A list with the following items:

beta.final

Regression coefficient estimates from final model

aic.final

AIC for final model

summary.final

Summary output of final model

stack.ss

Vector of indices to indicate the level at which each covariate enters the model

Author(s)

Lauren Grant, David Wheeler

References

Grant LP, Gennings C, Wheeler, DC. (2015). Selecting spatial scale of covariates in regression models of environmental exposures. Cancer Informatics, 14(S2), 81-96. doi: 10.4137/CIN.S17302

Examples

1
2
3
4
5
data(y)
data(X.3D)
y.name <- "y"
ss <- c("ind", "ss1", "ss2")
mod_forward.step.ss_1 <- stepwise.ss(y, X.3D, y.name, ss, 1)

Example output

Loading required package: tester
Loading required package: magic
Loading required package: abind
Loading required package: pracma

Attaching package: 'pracma'

The following object is masked from 'package:magic':

    magic

[1] "Results are with no intercept."
[1] "Start: AIC = -1.0259"
[1] "y ~ 0"
[1] 1
[1] "Step: AIC = -10.3344"
[1] "y ~ ss1_x2.ss1"
[1] 2
[1] "Step: AIC = -13.6769"
y ~ ss1_x2.ss1 + ind_x1.ind 
[1] "Diff in AIC = 3.3425"
[1] 3
[1] "Step: AIC = -22.6657"
y ~ ss1_x2.ss1 + ind_x1.ind + ss2_x3.ss2 
[1] "Diff in AIC = 8.9887"

Call:
lm(formula = y ~ . - 1, data = X.in, x = TRUE, y = TRUE)

Coefficients:
ss1_x2.ss1  ind_x1.ind  ss2_x3.ss2  
    0.6784      0.4703      0.4443  

[1] "Diff in AIC = 8.9887"
[1] "Epsilon = 1"
[1] "No. of vars in model = 3"
[1] "Total no. of vars possible = 3"

spselect documentation built on May 2, 2019, 3:32 a.m.