SL.glm.manning: Adaptive generalized linear model of Manning (2001)

Description Usage Arguments Value References Examples

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

Description

This function implements the estimator of Manning and Mullahy (2001). The estimator adaptively selects a link function and family based on the skewness and kurtosis of the data. Some of the family/link functions recommended by Manning are numerically unstable and so this function returns Duan's smearing estimate if the GLM fitting step breaks down.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
SL.glm.manning(
  Y,
  X,
  newX,
  family = gaussian(),
  obsWeights = rep(1, length(Y)),
  kCut = 3,
  lambdaCut = c(0.5, 1.5, 2.5),
  startNLS = 0,
  ...
)

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)

kCut

Cut point for kurtosis

lambdaCut

Cut points for skewness

startNLS

Starting values for the non-linear least squares

...

Other arguments (not currently used)

Value

pred

Predicted outcomes based on predictors in newX

fit

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

References

Manning WG, Mullahy J (2001). “Estimating log models: to transform or not to transform?” Journal of Health Economics, 20(4), 461–494.

Examples

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

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