tlverse / tmle3mopttx

🎯 💯 Targeted Learning and Variable Importance for the Causal Effect of an Optimal Individualized Treatment Intervention
GNU General Public License v3.0
10 stars 3 forks source link

Categorical treatment example in tlverse handbook #12

Closed felix515 closed 2 years ago

felix515 commented 2 years ago

Thank you for the great package, I have been trying to find information on extending TMLE to categorical treatments and this is perfect.

This not specific to the github code but I wanted to mention, I saw you recently closed an issue with the categorical test returning an error. I was experiencing this error as well when attempting to follow the example code from https://tlverse.org/tlverse-handbook/optimal-individualized-treatment-regimes.html.

I am able to use your new categorical test file as written, but if I change to blip1 I get an error about a malformed data table: Error in[.data.table(private$.data, , columns, with = FALSE) : Column 49 ['5b6a6afd-e49a-4261-b508-c2b2d2f1557e_A'] is a data.frame or data.table; malformed data.table.

I have been reviewing the source code to understand the methodology and in line 152 of optimal_rule_revere.R, it seems like blip1 is coded to binary treatment, whereas the other blips use all available columns of DR. (I am a Python programmer so my ability to read R is not great, sorry if I'm way off.)

I really appreciate the examples and have been working through them toward a better understanding of categorical treatments.

imalenica commented 2 years ago

Thanks so much for pointing it out! I'll look into this issue shortly.

imalenica commented 2 years ago

Thank you for pointing this out. The newest updates on master fix the issue and allow for manual reference category.