Skip to content

Commit

Permalink
Update more float precision changes
Browse files Browse the repository at this point in the history
  • Loading branch information
KennyZhang-17 committed Dec 1, 2024
1 parent 2d2b2a3 commit 13e33ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions sensemakr/bias_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@
>>> float(smkr.adjusted_estimate(model = fitted_model, treatment = "directlyharmed", r2dz_x = 0.05, r2yz_dx = 0.05)) # doctest: +NUMBER
0.06393
>>> # Computes adjusted SE for confounder with r2dz_x = 0.05, r2yz_dx = 0.05
>>> smkr.adjusted_se(model = fitted_model, treatment = "directlyharmed", r2dz_x = 0.05, r2yz_dx = 0.05) # doctest: +NUMBER
>>> float(smkr.adjusted_se(model = fitted_model, treatment = "directlyharmed", r2dz_x = 0.05, r2yz_dx = 0.05)) # doctest: +NUMBER
0.02327
>>> # Computes adjusted t-value for confounder with r2dz_x = 0.05, r2yz_dx = 0.05
>>> smkr.adjusted_t(model = fitted_model, treatment = "directlyharmed", r2dz_x = 0.05, r2yz_dx = 0.05) # doctest: +NUMBER
>>> float(smkr.adjusted_t(model = fitted_model, treatment = "directlyharmed", r2dz_x = 0.05, r2yz_dx = 0.05)) # doctest: +NUMBER
2.74724
>>> # Alternatively, pass in numerical values directly.
>>> smkr.adjusted_estimate(estimate = 0.09731582, se = 0.02325654, dof = 783, r2dz_x = 0.05, r2yz_dx = 0.05) # doctest: +NUMBER
>>> float(smkr.adjusted_estimate(estimate = 0.09731582, se = 0.02325654, dof = 783, r2dz_x = 0.05, r2yz_dx = 0.05)) # doctest: +NUMBER
0.06393
>>> smkr.adjusted_se(se = 0.02325654, dof = 783, r2dz_x = 0.05, r2yz_dx = 0.05) # doctest: +NUMBER
>>> float(smkr.adjusted_se(se = 0.02325654, dof = 783, r2dz_x = 0.05, r2yz_dx = 0.05)) # doctest: +NUMBER
0.02327
>>> smkr.adjusted_t(estimate = 0.09731582, se = 0.02325654, dof = 783, r2dz_x = 0.05, r2yz_dx = 0.05) # doctest: +NUMBER
>>> float(smkr.adjusted_t(estimate = 0.09731582, se = 0.02325654, dof = 783, r2dz_x = 0.05, r2yz_dx = 0.05)) # doctest: +NUMBER
2.74724
"""

Expand Down
4 changes: 2 additions & 2 deletions sensemakr/sensitivity_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ def partial_r2(model=None, covariates=None, t_statistic=None, dof=None):
>>> float(smkr.partial_r2(model = fitted_model, covariates = "directlyharmed")) # doctest: +NUMBER
0.02187
>>> # Partial R2 of female with peacefactor:
>>> smkr.partial_r2(model = fitted_model, covariates = "female") # doctest: +NUMBER
>>> float(smkr.partial_r2(model = fitted_model, covariates = "female")) # doctest: +NUMBER
0.10903
>>> # You can also provide the statistics directly:
>>> smkr.partial_r2(t_statistic = 4.18445, dof = 783) # doctest: +NUMBER
>>> float(smkr.partial_r2(t_statistic = 4.18445, dof = 783)) # doctest: +NUMBER
0.021873
"""
if model is None and (t_statistic is None or dof is None):
Expand Down

0 comments on commit 13e33ba

Please sign in to comment.