|
176 | 176 | " return numer / denom\n", |
177 | 177 | "\n", |
178 | 178 | "\n", |
179 | | - "@njit(cache=True, parallel=True)\n", |
| 179 | + "@njit(cache=True) # parallelization must be turned off for random number generation\n", |
180 | 180 | "def bootstrap_indices(is_paired, x0_len, x1_len, resamples, random_seed):\n", |
181 | 181 | " np.random.seed(random_seed)\n", |
182 | 182 | " indices = np.empty((resamples, x0_len if is_paired else x0_len + x1_len), dtype=np.int64)\n", |
|
213 | 213 | "\n", |
214 | 214 | " return out\n", |
215 | 215 | "\n", |
216 | | - "@njit(cache=True, parallel=True)\n", |
| 216 | + "@njit(cache=True) # parallelization must be turned off for random number generation\n", |
217 | 217 | "def delta2_bootstrap_loop(x1, x2, x3, x4, resamples, pooled_sd, rng_seed, is_paired):\n", |
218 | 218 | " np.random.seed(rng_seed)\n", |
219 | 219 | " out_delta_g = np.empty(resamples)\n", |
|
324 | 324 | " return (100.0 - ci) / 100.0\n", |
325 | 325 | "\n", |
326 | 326 | "\n", |
327 | | - "@njit(cache=True)\n", |
| 327 | + "# @njit(cache=True)\n", |
328 | 328 | "def _compute_quantile(z, bias, acceleration):\n", |
329 | 329 | " numer = bias + z\n", |
330 | 330 | " denom = 1 - (acceleration * numer)\n", |
|
365 | 365 | " return control_var / control_N + test_var / test_N\n", |
366 | 366 | "\n", |
367 | 367 | "\n", |
368 | | - "@njit(cache=True)\n", |
369 | 368 | "def calculate_weighted_delta(group_var, differences):\n", |
370 | 369 | " \"\"\"\n", |
371 | 370 | " Compute the weighted deltas.\n", |
372 | 371 | " \"\"\"\n", |
373 | 372 | "\n", |
374 | 373 | " weight = 1 / group_var\n", |
375 | 374 | " denom = np.sum(weight)\n", |
376 | | - " num = np.sum(weight[i] * differences[i] for i in range(0, len(weight)))\n", |
| 375 | + " num = 0.0\n", |
| 376 | + " for i in range(len(weight)):\n", |
| 377 | + " num += weight[i] * differences[i]\n", |
377 | 378 | "\n", |
378 | 379 | " return num / denom" |
379 | 380 | ] |
380 | | - }, |
381 | | - { |
382 | | - "cell_type": "code", |
383 | | - "execution_count": null, |
384 | | - "id": "87e0c164", |
385 | | - "metadata": {}, |
386 | | - "outputs": [], |
387 | | - "source": [] |
388 | 381 | } |
389 | 382 | ], |
390 | 383 | "metadata": { |
391 | 384 | "kernelspec": { |
392 | 385 | "display_name": "python3", |
393 | 386 | "language": "python", |
394 | 387 | "name": "python3" |
395 | | - }, |
396 | | - "language_info": { |
397 | | - "name": "python", |
398 | | - "version": "3.11.8" |
399 | 388 | } |
400 | 389 | }, |
401 | 390 | "nbformat": 4, |
|
0 commit comments