Learn R Programming

spselect (version 0.0.1)

lasso.ss: Spatial scale lasso

Description

This function fits a spatial scale (SS) lasso model.

Usage

lasso.ss(y, X, ss, a.lst, S.v, C.v, col.plot, verbose=TRUE, plot=TRUE)

Arguments

y
A numeric response vector
X
A data frame of numeric variables
ss
A vector of names to identify the different levels of covariates available as potential candidates for model input
a.lst
A list of identity matrices, where each column indicates a particular level or spatial scale for a specified covariate (e.g., ss1_x2)
S.v
A vector of positive integers, where each number denotes the number of spatial scales associated with a particular covariate
C.v
A vector, where all values are initialized to 0
col.plot
A vector of colors (corresponding to each SS) used in the coefficient path plot
verbose
If TRUE, details are printed as the algorithm progresses
plot
If TRUE, a coefficient path plot is generated

Value

A list with the following items:

Details

This function estimates coefficients using the SS lasso modeling approach. The function also provides summary details and plots a coefficient path plot.

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

Run this code
data(y)
data(X)

names.X <- colnames(X)

ss <- c("ind", "ss1", "ss2")

a.lst <- list(NULL)
a.lst[[1]] <- 1
dim(a.lst[[1]]) <- c(1,1)
dimnames(a.lst[[1]]) <- list(NULL, names.X[1])

a.lst[[2]] <- diag(2)
dimnames(a.lst[[2]]) <- list(NULL, names.X[c(2,3)])

a.lst[[3]] <- diag(2)
dimnames(a.lst[[3]]) <- list(NULL, names.X[c(4,5)])

S.v <- c(1,2,2)
C.v <- rep(0,length(a.lst))

mod_lasso.ss <- lasso.ss(y, X, ss, a.lst, S.v, C.v, c("black", "red", "green"))

Run the code above in your browser using DataLab