SL.smearglm: Generalized linear model with Gaussian family and log link -...

Description Usage Arguments Value References Examples

View source: R/SL.smearglm.R

Description

Implements the "smearing" estimator of Duan (1983), which fits a linear model on the log transformed outcome and transforms to an estimate of the conditional mean on the original scale.

Usage

1
SL.smearglm(Y, X, newX, family, obsWeights, ...)

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

...

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) and smear_factor (the estimated smearing factor)

References

Duan, N. (1983) Smearing estimate: a nonparametric retransformation method. Journal of the American Statistical Association, 78, 605-610.

Examples

1
2
3
4
5
6
7
# load cost data
data(cost_data)
# fit smear estimator
fit_smearglm <- SL.smearglm(Y = cost_data$totalcost, X = cost_data[, c("female", "race")],
                              newX = cost_data[, c("female", "race")])
# get back predictions
pred_smearglm <- predict(fit_smearglm$fit, newdata = cost_data[,c("female", "race")])

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