Skip to content

Bug when nonlinear lasso is used as learners_DX #73

@hjuerges

Description

@hjuerges

Hello,

I think the prediction from a logit lasso should be set to type = "response". Otherwise the linear prediction of the link function is used which leads to massive trimming. See example below.

But otherwise, thanks for writing this package in R. I am trying to find an easily accessible double machine learning function in R for my students, and I think this could be it.

Kind regards
Hendrik


library(ddml)

Construct variables from the included Angrist & Evans (1998) data

y = AE98[, "worked"]
D = AE98[, "morekids"]
X = AE98[, c("age","agefst","black","hisp","othrace","educ")]

Estimate the average treatment effect using linear lasso in the Y and the D Model

ate_fit <- ddml_ate(y, D, X,
learners = list(what = mdl_glmnet,
args = list(alpha = 1)),
sample_folds = 2,
silent = TRUE)
summary(ate_fit)

Estimate the average treatment effect using a logit for the D model

ate_fit <- ddml_ate(y, D, X,
learners = list(what = mdl_glmnet,
args = list(alpha = 1)),
learners_DX = list(what = mdl_glmnet,
args = list(family = "binomial")),
sample_folds = 2,
silent = TRUE)
summary(ate_fit)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions