Skip to content

Commit 5343c99

Browse files
committed
add SGD robustIV example
1 parent f5a244f commit 5343c99

File tree

2 files changed

+646
-4
lines changed

2 files changed

+646
-4
lines changed

jax_gmm.ipynb

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 2,
5+
"execution_count": 1,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -164,7 +164,7 @@
164164
},
165165
{
166166
"cell_type": "code",
167-
"execution_count": 1,
167+
"execution_count": 6,
168168
"metadata": {},
169169
"outputs": [],
170170
"source": [
@@ -175,7 +175,7 @@
175175
},
176176
{
177177
"cell_type": "code",
178-
"execution_count": 3,
178+
"execution_count": 7,
179179
"metadata": {},
180180
"outputs": [],
181181
"source": [
@@ -193,6 +193,31 @@
193193
" return wt"
194194
]
195195
},
196+
{
197+
"cell_type": "code",
198+
"execution_count": 9,
199+
"metadata": {},
200+
"outputs": [
201+
{
202+
"data": {
203+
"text/plain": [
204+
"Array(6.418394, dtype=float32)"
205+
]
206+
},
207+
"execution_count": 9,
208+
"metadata": {},
209+
"output_type": "execute_result"
210+
}
211+
],
212+
"source": [
213+
"sim = ec.data.kang_schafer.Simulation(size=1000)\n",
214+
"w, y, X = sim.treatment, sim.outcome, np.c_[np.repeat(1, 1000), sim.covariates]\n",
215+
"X0, X1 = X[w == 0, :], X[w == 1, :].mean(0)\n",
216+
"b_start = np.random.rand(X.shape[1])\n",
217+
"eb_moment(b_start, X0, X1)\n",
218+
"# wt = ebwt(X0, X1)\n"
219+
]
220+
},
196221
{
197222
"cell_type": "code",
198223
"execution_count": 4,
@@ -305,7 +330,7 @@
305330
"name": "python",
306331
"nbconvert_exporter": "python",
307332
"pygments_lexer": "ipython3",
308-
"version": "3.10.14"
333+
"version": "3.11.7"
309334
}
310335
},
311336
"nbformat": 4,

0 commit comments

Comments
 (0)