SL.glm.gamma: Generalized linear model with gamma family and user-specified...

Description Usage Arguments Value Examples

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

Description

Generalized linear model with gamma family and user-specified link function

Usage

1
SL.glm.gamma(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 gamma glm with log link model
fit_glm.gamma <- SL.glm.gamma(Y = cost_data$totalcost, X = cost_data[, c("female", "race")],
                              newX = cost_data[, c("female", "race")])
# get back predictions
pred_glm.gamma <- predict(fit_glm.gamma$fit, newdata = cost_data[,c("female", "race")])

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