SL.glm.gaussianlog: Generalized linear model with Gaussian family and log link

Description Usage Arguments Value Examples

View source: R/SL.glm.gaussianlog.R

Description

The glm.fit algorithm is notoriously unstable for this fitting. If convergence issues arise, try different starting values.

Usage

1
SL.glm.gaussianlog(Y, X, newX, family, obsWeights, link = "log", ...)

Arguments

Y

A numeric outcome variable

X

A data.frame of covariates constituting the training sample

newX

A data.frame with the same column names and format as X constituting the validation sample.

family

Gaussian only

obsWeights

Observation-level weights (not currently used)

link

Link function

...

Other arguments (not currently used)

Value

pred

Predicted outcomes based on predictors in newX

fit

A list with named entries object (the fitted glm regression object)

Examples

1
2
3
4
5
6
7
# load cost data
data(cost_data)
# fit gaussian glm with log link
fit_glm.gaussianlog <- SL.glm.gaussianlog(Y = cost_data$totalcost, X = cost_data[, c("female", "race")],
                              newX = cost_data[, c("female", "race")])
# get back predictions
pred_glm.gaussianlog <- predict(fit_glm.gaussianlog$fit, newdata = cost_data[,c("female", "race")])

wuziyueemory/twostageSL documentation built on Oct. 19, 2020, 3:45 p.m.