zepid.calc.utils.rubins_rules¶
-
zepid.calc.utils.
rubins_rules
(point_estimates, std_error)¶ Function to merge multiple imputed data sets into a single summary estimate and variance. Results are based on Rubin’s Rules for merging estimates. The summary point estimate is calculated via
\[\bar{\beta} = m^{-1} \sum_{k=1}^m \hat{\beta_k}\]where m is the number of imputed data sets. The variance is calculated via
\[Var(\hat{\beta}) = m_{-1} \sum_{k=1}^m Var(\hat{\beta}) + (1 + m^{-1})(m-1)^{-1} \sum_{k=1}^m (\hat{\beta_k} - \bar{\beta})^2\]The variance is constructed from the within-sample variance and the between sample variance
Notes
If your point estimates correspond to ratios, be sure to provide the natural-log transformed point estimates and the variance of the natural-log estimate
Parameters: - point_estimates (list) – Container object of the point estimates
- std_error (list) – Container object of the estimate standard errors
Returns: Tuple of summary beta, summary standard error
Return type: tuple
Examples
>>> from zepid.calc import rubins_rules >>> rr_est = [] >>> rr_std = []
Calculating summary estimate
>>> b = rubins_rules(rr_est, rr_std)
Printing the summary risk ratio
>>> print("RR = ", np.exp(b[0])) >>> print("95% LCL:", np.exp(b[0] - 1.96*b[1])) >>> print("95% UCL:", np.exp(b[0] + 1.96*b[1]))
References
Rubin DB. (2004). Multiple imputation for nonresponse in surveys (Vol. 81). John Wiley & Sons.