Skip to content

Commit

Permalink
include sample size in sigma passed to univariate simulations
Browse files Browse the repository at this point in the history
  • Loading branch information
mbi6245 committed Aug 5, 2024
1 parent 1202001 commit 394f858
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions simulations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
" # generate data from given distribution, calculate sample_mean, sample_sd\n",
" data = distribution_func(size=sample_size, **distribution_params)\n",
" x_bar = np.mean(data)\n",
" sigma_hat = np.std(data)\n",
" sigma_hat = np.std(data) / np.sqrt(sample_size)\n",
"\n",
" # run delta method transformation for transformed_mean and transformed_sd\n",
" mu_txs[i], sigma_tx = transform_univariate(x_bar, sigma_hat, transform_func, \"delta\")\n",
"\n",
" # calculate CI bounds with transformed_mean + Q * transformed_sd / sqrt(sample_size)\n",
" ci_uppers[i] = mu_txs[i] + Q * sigma_tx / np.sqrt(sample_size)\n",
" ci_lowers[i] = mu_txs[i] - Q * sigma_tx / np.sqrt(sample_size)\n",
" ci_uppers[i] = mu_txs[i] + Q * sigma_tx\n",
" ci_lowers[i] = mu_txs[i] - Q * sigma_tx\n",
"\n",
" # indicate coverage success when transformed mean lies between CI bounds as described above\n",
" if (ci_lowers[i] < truth and truth < ci_uppers[i]):\n",
Expand Down

0 comments on commit 394f858

Please sign in to comment.