@@ -64,6 +64,40 @@ Partially linear regression model (PLR)
6464 dml_plr_obj$fit()
6565 print(dml_plr_obj)
6666
67+ .. _lplr-model:
68+
69+ Logistic partially linear regression model (LPLR)
70+ *************************************************
71+
72+ .. include:: /guide/models/plm/lplr.rst
73+
74+ .. include:: /shared/causal_graphs/plr_irm_causal_graph.rst
75+
76+ ``DoubleMLLPLR`` implements LPLR models. Estimation is conducted via its ``fit()`` method.
77+
78+ .. note::
79+ Remark that the treatment effects are not additive in this model. The partial linear term enters the model through a logistic link function.
80+
81+ .. tab-set::
82+
83+ .. tab-item:: Python
84+ :sync: py
85+
86+ .. ipython:: python
87+
88+ import numpy as np
89+ import doubleml as dml
90+ from doubleml.plm.datasets import make_lplr_LZZ2020
91+ from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
92+ from sklearn.base import clone
93+ np.random.seed(3141 )
94+ ml_t = RandomForestRegressor(n_estimators=100 , max_features=15 , max_depth=15 , min_samples_leaf=5 )
95+ ml_m = RandomForestRegressor(n_estimators=100 , max_features=15 , max_depth=15 , min_samples_leaf=5 )
96+ ml_M = RandomForestClassifier(n_estimators=100 , max_features=15 , max_depth=15 , min_samples_leaf=5 )
97+ obj_dml_data = make_lplr_LZZ2020(alpha=0.5 , n_obs=1000 , dim_x=15 )
98+ dml_lplr_obj = dml.DoubleMLLPLR(obj_dml_data, ml_M, ml_t , ml_m)
99+ dml_lplr_obj.fit().summary
100+
67101
68102.. _pliv-model:
69103
@@ -91,12 +125,12 @@ Estimation is conducted via its ``fit()`` method:
91125 from sklearn.ensemble import RandomForestRegressor
92126 from sklearn.base import clone
93127
94- learner = RandomForestRegressor(n_estimators=100 , max_features=20 , max_depth=5 , min_samples_leaf=2 )
128+ learner = RandomForestRegressor(n_estimators=100 , max_features=5 , max_depth=5 , min_samples_leaf=5 )
95129 ml_l = clone(learner)
96130 ml_m = clone(learner)
97131 ml_r = clone(learner)
98132 np.random.seed(2222 )
99- data = make_pliv_CHS2015(alpha=0.5 , n_obs=500 , dim_x=20 , dim_z=1 , return_type=' DataFrame' )
133+ data = make_pliv_CHS2015(alpha=0.5 , n_obs=500 , dim_x=5 , dim_z=1 , return_type=' DataFrame' )
100134 obj_dml_data = dml.DoubleMLData(data, ' y' , ' d' , z_cols=' Z1' )
101135 dml_pliv_obj = dml.DoubleMLPLIV(obj_dml_data, ml_l, ml_m, ml_r)
102136 print(dml_pliv_obj.fit())
@@ -121,39 +155,3 @@ Estimation is conducted via its ``fit()`` method:
121155 dml_pliv_obj = DoubleMLPLIV$new(obj_dml_data, ml_l, ml_m, ml_r)
122156 dml_pliv_obj$fit()
123157 print(dml_pliv_obj)
124-
125- Logistic partially linear regression model (LPLR)
126- *************************************************
127-
128- .. include:: /guide/models/plm/lplr.rst
129-
130- .. include:: /shared/causal_graphs/plr_irm_causal_graph.rst
131-
132- ``DoubleMLLPLR`` implements LPLR models. Estimation is conducted via its ``fit()`` method.
133-
134- .. note::
135- Remark that the treatment effects are not additive in this model. The partial linear term enters the model through a logistic link function.
136-
137- .. tab-set::
138-
139- .. tab-item:: Python
140- :sync: py
141-
142- .. ipython:: python
143- :okwarning:
144-
145- import numpy as np
146- import doubleml as dml
147- from doubleml.plm.datasets import make_lplr_LZZ2020
148- from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
149- from sklearn.base import clone
150- np.random.seed(3141 )
151- ml_t = RandomForestRegressor(n_estimators=100 , max_features=20 , max_depth=5 , min_samples_leaf=2 )
152- ml_m = RandomForestRegressor(n_estimators=100 , max_features=20 , max_depth=5 , min_samples_leaf=2 )
153- ml_M = RandomForestClassifier(n_estimators=100 , max_features=20 , max_depth=5 , min_samples_leaf=2 )
154- obj_dml_data = make_lplr_LZZ2020(alpha=0.5 , n_obs=500 , dim_x=20 )
155- dml_lplr_obj = dml.DoubleMLPLR(obj_dml_data, ml_M, ml_t , ml_m)
156- dml_lplr_obj.fit().summary
157-
158-
159-
0 commit comments