ssga.reg: Shotgun Stochastic Genetic Algorithm

Description Usage Arguments Value Examples

Description

Simultaneously perform variable subet selection and model averaging with the shotgun stochastic genetic algorithm regression

Usage

1
2
ssga.reg(X, y, no.trials, model.type = "linear", fitness.fun = "AIC",
  forced.vars = NULL, print.flag = TRUE, penalty = NULL)

Arguments

X

A dataset whose rows represent a vector of p measurements across a set of independent variables

y

A set of outcomes

model.type

Specify the type of regression model ('linear', 'logistic', 'poisson')

fitness.fun

Specify the fitness function ('AIC', 'BIC', 'CUSTOM')

forced.vars

A set of 1 or more columns with the same number of rows as X, representing variables that are to be included in every regression model

print.flag

When print.flag is set to TRUE, the current trial, iteration, best model fitness score, and chromosome corresponding to the best model will be shown in the console

penalty

If fitness.fun = 'CUSTOM', the fitness function takes the form -2*logLike + penalty*nparam, where logLike refers to the maximized log-likelihood of the regression model and nparam is the total number of free parameters in the model; note: AIC = -2*logLike + 2*nparam

Value

Returns an object of class 'ssga'

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Load ICU workspace for logistic regression (data were obtained from aplore3 package)
load(system.file('extdata', 'ssga_icu_ws.RData', package = 'ssga'))
no.trials <- 5
model.type <- 'logistic'
fitness.fun <- 'AIC'
ssga.obj <- ssga.reg(X, y,
                     no.trials = no.trials,
                     model.type = model.type,
                     fitness.fun = fitness.fun,
                     print.flag = TRUE)
summary(ssga.obj)


## Poisson regression with the ICU data
model.type <- 'poisson'
y <- X[ , 'age']
X <- X[ , !colnames(X)%in%'age']
ssga.obj <- ssga.reg(X, y,
                     no.trials = no.trials,
                     model.type = model.type,
                     fitness.fun = fitness.fun)
summary(ssga.obj)


## Load Swiss workspace for linear regression
rm(list = ls(all = TRUE))
load(system.file('extdata', 'ssga_swiss_ws.RData', package = 'ssga'))
no.trials <- 5
model.type <- 'linear'
fitness.fun <- 'AIC'
ssga.obj <- ssga.reg(X, y,
                     no.trials = no.trials,
                     model.type = model.type,
                     fitness.fun = fitness.fun,
                     print.flag = TRUE)
summary(ssga.obj)

tjmassaro/ssga documentation built on May 6, 2019, 7:33 a.m.