forked from kwonsang/CRE
-
Notifications
You must be signed in to change notification settings - Fork 5
/
CRE.html
320 lines (290 loc) · 26.3 KB
/
CRE.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="CRE">
<title>CRE • CRE</title>
<script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="../deps/bootstrap-5.2.2/bootstrap.min.css" rel="stylesheet">
<script src="../deps/bootstrap-5.2.2/bootstrap.bundle.min.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- bootstrap-toc --><script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@v1.0.1/dist/bootstrap-toc.min.js" integrity="sha256-4veVQbu7//Lk5TSmc7YV48MxtMy98e26cf5MrgZYnwo=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="CRE">
<meta property="og:description" content="CRE">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<a href="#main" class="visually-hidden-focusable">Skip to contents</a>
<nav class="navbar fixed-top navbar-dark navbar-expand-lg bg-primary"><div class="container">
<a class="navbar-brand me-2" href="../index.html">CRE</a>
<small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">0.2.6</small>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbar" class="collapse navbar-collapse ms-3">
<ul class="navbar-nav me-auto">
<li class="active nav-item">
<a class="nav-link" href="../articles/CRE.html">Get started</a>
</li>
<li class="nav-item">
<a class="nav-link" href="../reference/index.html">Reference</a>
</li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" id="dropdown-articles">Articles</a>
<div class="dropdown-menu" aria-labelledby="dropdown-articles">
<h6 class="dropdown-header" data-toc-skip>Users</h6>
<div class="dropdown-divider"></div>
<h6 class="dropdown-header" data-toc-skip>Developers</h6>
<a class="dropdown-item" href="../articles/Contribution.html">Contribution</a>
<a class="dropdown-item" href="../articles/Testing-the-Package.html">Testing the CRE Package</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="../news/index.html">Changelog</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0" role="search">
<input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="../search.json" id="search-input" placeholder="Search for" autocomplete="off">
</form>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="https://github.com/NSAPH-Software/CRE/" aria-label="github">
<span class="fab fa fab fa-github fa-lg"></span>
</a>
</li>
</ul>
</div>
</div>
</nav><div class="container template-article">
<div class="row">
<main id="main" class="col-md-9"><div class="page-header">
<img src="" class="logo" alt=""><h1>CRE</h1>
<small class="dont-index">Source: <a href="https://github.com/NSAPH-Software/CRE/blob/HEAD/vignettes/CRE.Rmd"><code>vignettes/CRE.Rmd</code></a></small>
<div class="d-none name"><code>CRE.Rmd</code></div>
</div>
<div class="section level2">
<h2 id="installation">Installation<a class="anchor" aria-label="anchor" href="#installation"></a>
</h2>
<p>Installing from CRAN.</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/utils/install.packages.html" class="external-link">install.packages</a></span><span class="op">(</span><span class="st">"CRE"</span><span class="op">)</span></span></code></pre></div>
<p>Installing the latest developing version.</p>
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://devtools.r-lib.org/" class="external-link">devtools</a></span><span class="op">)</span></span>
<span><span class="fu"><a href="https://remotes.r-lib.org/reference/install_github.html" class="external-link">install_github</a></span><span class="op">(</span><span class="st">"NSAPH-Software/CRE"</span>, ref <span class="op">=</span> <span class="st">"develop"</span><span class="op">)</span></span></code></pre></div>
<p>Import.</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="st"><a href="https://github.com/NSAPH-Software/CRE">"CRE"</a></span><span class="op">)</span></span></code></pre></div>
</div>
<div class="section level2">
<h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a>
</h2>
<p><strong>Data (required)</strong></p>
<p><strong><code>y</code></strong> The observed response/outcome vector
(binary or continuous).</p>
<p><strong><code>z</code></strong> The treatment/exposure/policy vector
(binary).</p>
<p><strong><code>X</code></strong> The covariate matrix (binary or
continuous).</p>
<p><strong>Parameters (not required)</strong></p>
<p><strong><code>method_parameters</code></strong> The list of
parameters to define the models used, including:<br>
- <strong><code>ratio_dis</code></strong> The ratio of data delegated to
the discovery sub-sample (default: 0.5).<br>
- <strong><code>ite_method</code></strong> The method to estimate the
individual treatment effect (default: “aipw”) [1].<br>
- <strong><code>learner_ps</code></strong> The (<a href="https://CRAN.R-project.org/package=SuperLearner" class="external-link">SuperLearner</a>)
model for the propensity score estimation (default: “SL.xgboost”, used
only for “aipw”,“bart”,“cf” ITE estimators).<br>
- <strong><code>learner_y</code></strong> The (<a href="https://CRAN.R-project.org/package=SuperLearner" class="external-link">SuperLearner</a>)
model for the outcome estimation (default: “SL.xgboost”, used only for
“aipw”,“slearner”,“tlearner” and “xlearner” ITE estimators).</p>
<p><strong><code>hyper_params</code></strong> The list of hyper
parameters to fine tune the method, including:<br>
- <strong><code>intervention_vars</code></strong> Intervention-able
variables used for Rules Generation (default: <code>NULL</code>).<br>
- <strong><code>ntrees</code></strong> The number of decision trees for
random forest (default: 20).<br>
- <strong><code>node_size</code></strong> Minimum size of the trees’
terminal nodes (default: 20).<br>
- <strong><code>max_rules</code></strong> Maximum number of candidate
decision rules (default: 50).<br>
- <strong><code>max_depth</code></strong> Maximum rules length (default:
3).<br>
- <strong><code>t_decay</code></strong> The decay threshold for rules
pruning (default: 0.025).<br>
- <strong><code>t_ext</code></strong> The threshold to define too
generic or too specific (extreme) rules (default: 0.01).<br>
- <strong><code>t_corr</code></strong> The threshold to define
correlated rules (default: 1).<br>
- <strong><code>stability_selection</code></strong> Method for stability
selection for selecting the rules. <code>vanilla</code> for stability
selection, <code>error_control</code> for stability selection with error
control and <code>no</code> for no stability selection (default:
<code>vanilla</code>).<br>
- <strong><code>B</code></strong> Number of bootstrap samples for
stability selection in rules selection and uncertainty quantification in
estimation (default: 20). - <strong><code>subsample</code></strong>
Bootstrap ratio subsample for stability selection in rules selection and
uncertainty quantification in estimation (default: 0.5). -
<strong><code>offset</code></strong> Name of the covariate to use as
offset (i.e. “x1”) for T-Poisson ITE Estimation. <code>NULL</code> if
not used (default: <code>NULL</code>).<br>
- <strong><code>cutoff</code></strong> Threshold defining the minimum
cutoff value for the stability scores in Stability Selection (default:
0.9).<br>
- <strong><code>pfer</code></strong> Upper bound for the per-family
error rate (tolerated amount of falsely selected rules) in Error Control
Stability Selection (default: 1).</p>
<p><strong>Additional Estimates (not required)</strong></p>
<p><strong><code>ite</code></strong> The estimated ITE vector. If given,
both the ITE estimation steps in Discovery and Inference are skipped
(default: <code>NULL</code>).</p>
<div class="section level3">
<h3 id="notes">Notes<a class="anchor" aria-label="anchor" href="#notes"></a>
</h3>
<div class="section level4">
<h4 id="options-for-the-ite-estimation">Options for the ITE estimation<a class="anchor" aria-label="anchor" href="#options-for-the-ite-estimation"></a>
</h4>
<p><strong>[1]</strong> Options for the ITE estimation are as
follows:<br>
- <a href="https://CRAN.R-project.org/package=SuperLearner" class="external-link">S-Learner</a>
(<code>slearner</code>).<br>
- <a href="https://CRAN.R-project.org/package=SuperLearner" class="external-link">T-Learner</a>
(<code>tlearner</code>)<br>
- T-Poisson(<code>tpoisson</code>)<br>
- <a href="https://CRAN.R-project.org/package=SuperLearner" class="external-link">X-Learner</a>
(<code>xlearner</code>)<br>
- <a href="https://CRAN.R-project.org/package=SuperLearner" class="external-link">Augmented
Inverse Probability Weighting</a> (<code>aipw</code>)<br>
- <a href="https://CRAN.R-project.org/package=grf" class="external-link">Causal Forests</a>
(<code>cf</code>)<br>
- <a href="https://CRAN.R-project.org/package=bartCause" class="external-link">Causal Bayesian
Additive Regression Trees</a> (<code>bart</code>)</p>
<p>If other estimates of the ITE are provided in <code>ite</code>
additional argument, both the ITE estimations in discovery and inference
are skipped and those values estimates are used instead. The ITE
estimator requires also an outcome learner and/or a propensity score
learner from the <a href="https://CRAN.R-project.org/package=SuperLearner" class="external-link">SuperLearner</a>
package (i.e., “SL.lm”, “SL.svm”). Both these models are simple
classifiers/regressors. By default XGBoost algorithm is used for both
these steps.</p>
</div>
<div class="section level4">
<h4 id="customized-wrapper-for-superlearner">Customized wrapper for SuperLearner<a class="anchor" aria-label="anchor" href="#customized-wrapper-for-superlearner"></a>
</h4>
<p>One can create a customized wrapper for SuperLearner internal
packages. The following is an example of providing the number of cores
(e.g., 12) for the xgboost package in a shared memory system.</p>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">m_xgboost</span> <span class="op"><-</span> <span class="kw">function</span><span class="op">(</span><span class="va">nthread</span> <span class="op">=</span> <span class="fl">12</span>, <span class="va">...</span><span class="op">)</span> <span class="op">{</span></span>
<span> <span class="fu">SuperLearner</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/SuperLearner/man/SL.xgboost.html" class="external-link">SL.xgboost</a></span><span class="op">(</span>nthread <span class="op">=</span> <span class="va">nthread</span>, <span class="va">...</span><span class="op">)</span></span>
<span><span class="op">}</span></span></code></pre></div>
<p>Then use “m_xgboost”, instead of “SL.xgboost”.</p>
</div>
</div>
</div>
<div class="section level2">
<h2 id="examples">Examples<a class="anchor" aria-label="anchor" href="#examples"></a>
</h2>
<p>Example 1 (<em>default parameters</em>)</p>
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/Random.html" class="external-link">set.seed</a></span><span class="op">(</span><span class="fl">9687</span><span class="op">)</span></span>
<span><span class="va">dataset</span> <span class="op"><-</span> <span class="fu"><a href="../reference/generate_cre_dataset.html">generate_cre_dataset</a></span><span class="op">(</span>n <span class="op">=</span> <span class="fl">1000</span>, </span>
<span> rho <span class="op">=</span> <span class="fl">0</span>, </span>
<span> n_rules <span class="op">=</span> <span class="fl">2</span>, </span>
<span> p <span class="op">=</span> <span class="fl">10</span>,</span>
<span> effect_size <span class="op">=</span> <span class="fl">2</span>, </span>
<span> binary_covariates <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span> binary_outcome <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> confounding <span class="op">=</span> <span class="st">"no"</span><span class="op">)</span></span>
<span><span class="va">y</span> <span class="op"><-</span> <span class="va">dataset</span><span class="op">[[</span><span class="st">"y"</span><span class="op">]</span><span class="op">]</span></span>
<span><span class="va">z</span> <span class="op"><-</span> <span class="va">dataset</span><span class="op">[[</span><span class="st">"z"</span><span class="op">]</span><span class="op">]</span></span>
<span><span class="va">X</span> <span class="op"><-</span> <span class="va">dataset</span><span class="op">[[</span><span class="st">"X"</span><span class="op">]</span><span class="op">]</span></span>
<span></span>
<span><span class="va">cre_results</span> <span class="op"><-</span> <span class="fu"><a href="../reference/cre.html">cre</a></span><span class="op">(</span><span class="va">y</span>, <span class="va">z</span>, <span class="va">X</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">cre_results</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">cre_results</span><span class="op">)</span></span>
<span><span class="va">ite_pred</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/stats/predict.html" class="external-link">predict</a></span><span class="op">(</span><span class="va">cre_results</span>, <span class="va">X</span><span class="op">)</span></span></code></pre></div>
<p>Example 2 (<em>personalized ite estimation</em>)</p>
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/Random.html" class="external-link">set.seed</a></span><span class="op">(</span><span class="fl">9687</span><span class="op">)</span></span>
<span><span class="va">dataset</span> <span class="op"><-</span> <span class="fu"><a href="../reference/generate_cre_dataset.html">generate_cre_dataset</a></span><span class="op">(</span>n <span class="op">=</span> <span class="fl">1000</span>, </span>
<span> rho <span class="op">=</span> <span class="fl">0</span>, </span>
<span> n_rules <span class="op">=</span> <span class="fl">2</span>, </span>
<span> p <span class="op">=</span> <span class="fl">10</span>,</span>
<span> effect_size <span class="op">=</span> <span class="fl">2</span>, </span>
<span> binary_covariates <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span> binary_outcome <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> confounding <span class="op">=</span> <span class="st">"no"</span><span class="op">)</span></span>
<span> <span class="va">y</span> <span class="op"><-</span> <span class="va">dataset</span><span class="op">[[</span><span class="st">"y"</span><span class="op">]</span><span class="op">]</span></span>
<span> <span class="va">z</span> <span class="op"><-</span> <span class="va">dataset</span><span class="op">[[</span><span class="st">"z"</span><span class="op">]</span><span class="op">]</span></span>
<span> <span class="va">X</span> <span class="op"><-</span> <span class="va">dataset</span><span class="op">[[</span><span class="st">"X"</span><span class="op">]</span><span class="op">]</span></span>
<span></span>
<span><span class="va">ite_pred</span> <span class="op"><-</span> <span class="va">...</span> <span class="co"># personalized ite estimation</span></span>
<span><span class="va">cre_results</span> <span class="op"><-</span> <span class="fu"><a href="../reference/cre.html">cre</a></span><span class="op">(</span><span class="va">y</span>, <span class="va">z</span>, <span class="va">X</span>, ite <span class="op">=</span> <span class="va">ite_pred</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">cre_results</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">cre_results</span><span class="op">)</span></span>
<span><span class="va">ite_pred</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/stats/predict.html" class="external-link">predict</a></span><span class="op">(</span><span class="va">cre_results</span>, <span class="va">X</span><span class="op">)</span></span></code></pre></div>
<p>Example 3 (<em>setting parameters</em>)</p>
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/Random.html" class="external-link">set.seed</a></span><span class="op">(</span><span class="fl">9687</span><span class="op">)</span></span>
<span><span class="va">dataset</span> <span class="op"><-</span> <span class="fu"><a href="../reference/generate_cre_dataset.html">generate_cre_dataset</a></span><span class="op">(</span>n <span class="op">=</span> <span class="fl">1000</span>, </span>
<span> rho <span class="op">=</span> <span class="fl">0</span>, </span>
<span> n_rules <span class="op">=</span> <span class="fl">2</span>, </span>
<span> p <span class="op">=</span> <span class="fl">10</span>,</span>
<span> effect_size <span class="op">=</span> <span class="fl">2</span>, </span>
<span> binary_covariates <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span> binary_outcome <span class="op">=</span> <span class="cn">FALSE</span>,</span>
<span> confounding <span class="op">=</span> <span class="st">"no"</span><span class="op">)</span></span>
<span><span class="va">y</span> <span class="op"><-</span> <span class="va">dataset</span><span class="op">[[</span><span class="st">"y"</span><span class="op">]</span><span class="op">]</span></span>
<span><span class="va">z</span> <span class="op"><-</span> <span class="va">dataset</span><span class="op">[[</span><span class="st">"z"</span><span class="op">]</span><span class="op">]</span></span>
<span><span class="va">X</span> <span class="op"><-</span> <span class="va">dataset</span><span class="op">[[</span><span class="st">"X"</span><span class="op">]</span><span class="op">]</span></span>
<span></span>
<span><span class="va">method_params</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>ratio_dis <span class="op">=</span> <span class="fl">0.5</span>,</span>
<span> ite_method <span class="op">=</span><span class="st">"aipw"</span>,</span>
<span> learner_ps <span class="op">=</span> <span class="st">"SL.xgboost"</span>,</span>
<span> learner_y <span class="op">=</span> <span class="st">"SL.xgboost"</span><span class="op">)</span></span>
<span></span>
<span><span class="va">hyper_params</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html" class="external-link">list</a></span><span class="op">(</span>intervention_vars <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"x1"</span>,<span class="st">"x2"</span>,<span class="st">"x3"</span>,<span class="st">"x4"</span><span class="op">)</span>,</span>
<span> offset <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span> ntrees <span class="op">=</span> <span class="fl">20</span>,</span>
<span> node_size <span class="op">=</span> <span class="fl">20</span>,</span>
<span> max_rules <span class="op">=</span> <span class="fl">50</span>,</span>
<span> max_depth <span class="op">=</span> <span class="fl">3</span>,</span>
<span> t_decay <span class="op">=</span> <span class="fl">0.025</span>,</span>
<span> t_ext <span class="op">=</span> <span class="fl">0.025</span>,</span>
<span> t_corr <span class="op">=</span> <span class="fl">1</span>,</span>
<span> stability_selection <span class="op">=</span> <span class="st">"vanilla"</span>,</span>
<span> cutoff <span class="op">=</span> <span class="fl">0.8</span>,</span>
<span> pfer <span class="op">=</span> <span class="fl">1</span>,</span>
<span> B <span class="op">=</span> <span class="fl">10</span>,</span>
<span> subsample <span class="op">=</span> <span class="fl">0.5</span><span class="op">)</span></span>
<span></span>
<span><span class="va">cre_results</span> <span class="op"><-</span> <span class="fu"><a href="../reference/cre.html">cre</a></span><span class="op">(</span><span class="va">y</span>, <span class="va">z</span>, <span class="va">X</span>, <span class="va">method_params</span>, <span class="va">hyper_params</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">cre_results</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/plot.default.html" class="external-link">plot</a></span><span class="op">(</span><span class="va">cre_results</span><span class="op">)</span></span>
<span><span class="va">ite_pred</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/stats/predict.html" class="external-link">predict</a></span><span class="op">(</span><span class="va">cre_results</span>, <span class="va">X</span><span class="op">)</span></span></code></pre></div>
<p>More synthetic data sets can be generated using
<code><a href="../reference/generate_cre_dataset.html">generate_cre_dataset()</a></code>.</p>
</div>
</main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>
</nav></aside>
</div>
<footer><div class="pkgdown-footer-left">
<p></p>
<p>Developed by Naeem Khoshnevis, Daniela Maria Garcia, Riccardo Cadei, Kwonsang Lee, Falco Joannes Bargagli Stoffi.</p>
</div>
<div class="pkgdown-footer-right">
<p></p>
<p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.0.7.</p>
</div>
</footer>
</div>
</body>
</html>