1{
2 "cells": [
3  {
4   "cell_type": "markdown",
5   "metadata": {},
6   "source": [
7    "# Meta-Analysis in statsmodels\n",
8    "\n",
9    "Statsmodels include basic methods for meta-analysis. This notebook illustrates the current usage.\n",
10    "\n",
11    "Status: The results have been verified against R meta and metafor packages. However, the API is still experimental and will still change. Some options for additional methods that are available in R meta and metafor are missing.\n",
12    "\n",
13    "The support for meta-analysis has 3 parts:\n",
14    "\n",
15    "- effect size functions: this currently includes\n",
16    "  ``effectsize_smd`` computes effect size and their standard errors for standardized mean difference,  \n",
17    "  ``effectsize_2proportions`` computes effect sizes for comparing two independent proportions using risk difference, (log) risk ratio, (log) odds-ratio or arcsine square root transformation\n",
18    "- The `combine_effects` computes fixed and random effects estimate for the overall mean or effect. The returned results instance includes a forest plot function.\n",
19    "- helper functions to estimate the random effect variance, tau-squared\n",
20    "\n",
21    "The estimate of the overall effect size in `combine_effects` can also be performed using WLS or GLM with var_weights.\n",
22    "\n",
23    "Finally, the meta-analysis functions currently do not include the Mantel-Hanszel method. However, the fixed effects results can be computed directly using `StratifiedTable` as illustrated below."
24   ]
25  },
26  {
27   "cell_type": "code",
28   "execution_count": null,
29   "metadata": {},
30   "outputs": [],
31   "source": [
32    "%matplotlib inline"
33   ]
34  },
35  {
36   "cell_type": "code",
37   "execution_count": null,
38   "metadata": {},
39   "outputs": [],
40   "source": [
41    "import numpy as np\n",
42    "import pandas as pd\n",
43    "from scipy import stats, optimize\n",
44    "\n",
45    "from statsmodels.regression.linear_model import WLS\n",
46    "from statsmodels.genmod.generalized_linear_model import GLM\n",
47    "\n",
48    "from statsmodels.stats.meta_analysis import (\n",
49    "    effectsize_smd,\n",
50    "    effectsize_2proportions,\n",
51    "    combine_effects,\n",
52    "    _fit_tau_iterative,\n",
53    "    _fit_tau_mm,\n",
54    "    _fit_tau_iter_mm,\n",
55    ")\n",
56    "\n",
57    "# increase line length for pandas\n",
58    "pd.set_option(\"display.width\", 100)"
59   ]
60  },
61  {
62   "cell_type": "markdown",
63   "metadata": {},
64   "source": [
65    "## Example"
66   ]
67  },
68  {
69   "cell_type": "code",
70   "execution_count": null,
71   "metadata": {},
72   "outputs": [],
73   "source": [
74    "data = [\n",
75    "    [\"Carroll\", 94, 22, 60, 92, 20, 60],\n",
76    "    [\"Grant\", 98, 21, 65, 92, 22, 65],\n",
77    "    [\"Peck\", 98, 28, 40, 88, 26, 40],\n",
78    "    [\"Donat\", 94, 19, 200, 82, 17, 200],\n",
79    "    [\"Stewart\", 98, 21, 50, 88, 22, 45],\n",
80    "    [\"Young\", 96, 21, 85, 92, 22, 85],\n",
81    "]\n",
82    "colnames = [\"study\", \"mean_t\", \"sd_t\", \"n_t\", \"mean_c\", \"sd_c\", \"n_c\"]\n",
83    "rownames = [i[0] for i in data]\n",
84    "dframe1 = pd.DataFrame(data, columns=colnames)\n",
85    "rownames"
86   ]
87  },
88  {
89   "cell_type": "code",
90   "execution_count": null,
91   "metadata": {},
92   "outputs": [],
93   "source": [
94    "mean2, sd2, nobs2, mean1, sd1, nobs1 = np.asarray(\n",
95    "    dframe1[[\"mean_t\", \"sd_t\", \"n_t\", \"mean_c\", \"sd_c\", \"n_c\"]]\n",
96    ").T\n",
97    "rownames = dframe1[\"study\"]\n",
98    "rownames.tolist()"
99   ]
100  },
101  {
102   "cell_type": "code",
103   "execution_count": null,
104   "metadata": {},
105   "outputs": [],
106   "source": [
107    "np.array(nobs1 + nobs2)"
108   ]
109  },
110  {
111   "cell_type": "markdown",
112   "metadata": {},
113   "source": [
114    "### estimate effect size standardized mean difference"
115   ]
116  },
117  {
118   "cell_type": "code",
119   "execution_count": null,
120   "metadata": {},
121   "outputs": [],
122   "source": [
123    "eff, var_eff = effectsize_smd(mean2, sd2, nobs2, mean1, sd1, nobs1)"
124   ]
125  },
126  {
127   "cell_type": "markdown",
128   "metadata": {},
129   "source": [
130    "### Using one-step chi2, DerSimonian-Laird estimate for random effects variance tau\n",
131    "\n",
132    "Method option for random effect `method_re=\"chi2\"` or `method_re=\"dl\"`, both names are accepted.\n",
133    "This is commonly referred to as the DerSimonian-Laird method, it is based on a moment estimator based on pearson chi2 from the fixed effects estimate."
134   ]
135  },
136  {
137   "cell_type": "code",
138   "execution_count": null,
139   "metadata": {},
140   "outputs": [],
141   "source": [
142    "res3 = combine_effects(eff, var_eff, method_re=\"chi2\", use_t=True, row_names=rownames)\n",
143    "# TODO: we still need better information about conf_int of individual samples\n",
144    "# We don't have enough information in the model for individual confidence intervals\n",
145    "# if those are not based on normal distribution.\n",
146    "res3.conf_int_samples(nobs=np.array(nobs1 + nobs2))\n",
147    "print(res3.summary_frame())"
148   ]
149  },
150  {
151   "cell_type": "code",
152   "execution_count": null,
153   "metadata": {},
154   "outputs": [],
155   "source": [
156    "res3.cache_ci"
157   ]
158  },
159  {
160   "cell_type": "code",
161   "execution_count": null,
162   "metadata": {},
163   "outputs": [],
164   "source": [
165    "res3.method_re"
166   ]
167  },
168  {
169   "cell_type": "code",
170   "execution_count": null,
171   "metadata": {},
172   "outputs": [],
173   "source": [
174    "fig = res3.plot_forest()\n",
175    "fig.set_figheight(6)\n",
176    "fig.set_figwidth(6)"
177   ]
178  },
179  {
180   "cell_type": "code",
181   "execution_count": null,
182   "metadata": {},
183   "outputs": [],
184   "source": [
185    "res3 = combine_effects(eff, var_eff, method_re=\"chi2\", use_t=False, row_names=rownames)\n",
186    "# TODO: we still need better information about conf_int of individual samples\n",
187    "# We don't have enough information in the model for individual confidence intervals\n",
188    "# if those are not based on normal distribution.\n",
189    "res3.conf_int_samples(nobs=np.array(nobs1 + nobs2))\n",
190    "print(res3.summary_frame())"
191   ]
192  },
193  {
194   "cell_type": "markdown",
195   "metadata": {},
196   "source": [
197    "### Using iterated, Paule-Mandel estimate for random effects variance tau\n",
198    "\n",
199    "The method commonly referred to as Paule-Mandel estimate is a method of moment estimate for the random effects variance that iterates between mean and variance estimate until convergence.\n"
200   ]
201  },
202  {
203   "cell_type": "code",
204   "execution_count": null,
205   "metadata": {},
206   "outputs": [],
207   "source": [
208    "res4 = combine_effects(\n",
209    "    eff, var_eff, method_re=\"iterated\", use_t=False, row_names=rownames\n",
210    ")\n",
211    "res4_df = res4.summary_frame()\n",
212    "print(\"method RE:\", res4.method_re)\n",
213    "print(res4.summary_frame())\n",
214    "fig = res4.plot_forest()"
215   ]
216  },
217  {
218   "cell_type": "code",
219   "execution_count": null,
220   "metadata": {},
221   "outputs": [],
222   "source": []
223  },
224  {
225   "cell_type": "markdown",
226   "metadata": {},
227   "source": [
228    "## Example Kacker interlaboratory mean\n",
229    "\n",
230    "In this example the effect size is the mean of measurements in a lab. We combine the estimates from several labs to estimate and overall average."
231   ]
232  },
233  {
234   "cell_type": "code",
235   "execution_count": null,
236   "metadata": {},
237   "outputs": [],
238   "source": [
239    "eff = np.array([61.00, 61.40, 62.21, 62.30, 62.34, 62.60, 62.70, 62.84, 65.90])\n",
240    "var_eff = np.array(\n",
241    "    [0.2025, 1.2100, 0.0900, 0.2025, 0.3844, 0.5625, 0.0676, 0.0225, 1.8225]\n",
242    ")\n",
243    "rownames = [\"PTB\", \"NMi\", \"NIMC\", \"KRISS\", \"LGC\", \"NRC\", \"IRMM\", \"NIST\", \"LNE\"]"
244   ]
245  },
246  {
247   "cell_type": "code",
248   "execution_count": null,
249   "metadata": {},
250   "outputs": [],
251   "source": [
252    "res2_DL = combine_effects(eff, var_eff, method_re=\"dl\", use_t=True, row_names=rownames)\n",
253    "print(\"method RE:\", res2_DL.method_re)\n",
254    "print(res2_DL.summary_frame())\n",
255    "fig = res2_DL.plot_forest()\n",
256    "fig.set_figheight(6)\n",
257    "fig.set_figwidth(6)"
258   ]
259  },
260  {
261   "cell_type": "code",
262   "execution_count": null,
263   "metadata": {},
264   "outputs": [],
265   "source": [
266    "res2_PM = combine_effects(eff, var_eff, method_re=\"pm\", use_t=True, row_names=rownames)\n",
267    "print(\"method RE:\", res2_PM.method_re)\n",
268    "print(res2_PM.summary_frame())\n",
269    "fig = res2_PM.plot_forest()\n",
270    "fig.set_figheight(6)\n",
271    "fig.set_figwidth(6)"
272   ]
273  },
274  {
275   "cell_type": "code",
276   "execution_count": null,
277   "metadata": {},
278   "outputs": [],
279   "source": []
280  },
281  {
282   "cell_type": "markdown",
283   "metadata": {},
284   "source": [
285    "## Meta-analysis of proportions\n",
286    "\n",
287    "In the following example the random effect variance tau is estimated to be zero. \n",
288    "I then change two counts in the data, so the second example has random effects variance greater than zero."
289   ]
290  },
291  {
292   "cell_type": "code",
293   "execution_count": null,
294   "metadata": {},
295   "outputs": [],
296   "source": [
297    "import io"
298   ]
299  },
300  {
301   "cell_type": "code",
302   "execution_count": null,
303   "metadata": {},
304   "outputs": [],
305   "source": [
306    "ss = \"\"\"\\\n",
307    "    study,nei,nci,e1i,c1i,e2i,c2i,e3i,c3i,e4i,c4i\n",
308    "    1,19,22,16.0,20.0,11,12,4.0,8.0,4,3\n",
309    "    2,34,35,22.0,22.0,18,12,15.0,8.0,15,6\n",
310    "    3,72,68,44.0,40.0,21,15,10.0,3.0,3,0\n",
311    "    4,22,20,19.0,12.0,14,5,5.0,4.0,2,3\n",
312    "    5,70,32,62.0,27.0,42,13,26.0,6.0,15,5\n",
313    "    6,183,94,130.0,65.0,80,33,47.0,14.0,30,11\n",
314    "    7,26,50,24.0,30.0,13,18,5.0,10.0,3,9\n",
315    "    8,61,55,51.0,44.0,37,30,19.0,19.0,11,15\n",
316    "    9,36,25,30.0,17.0,23,12,13.0,4.0,10,4\n",
317    "    10,45,35,43.0,35.0,19,14,8.0,4.0,6,0\n",
318    "    11,246,208,169.0,139.0,106,76,67.0,42.0,51,35\n",
319    "    12,386,141,279.0,97.0,170,46,97.0,21.0,73,8\n",
320    "    13,59,32,56.0,30.0,34,17,21.0,9.0,20,7\n",
321    "    14,45,15,42.0,10.0,18,3,9.0,1.0,9,1\n",
322    "    15,14,18,14.0,18.0,13,14,12.0,13.0,9,12\n",
323    "    16,26,19,21.0,15.0,12,10,6.0,4.0,5,1\n",
324    "    17,74,75,,,42,40,,,23,30\"\"\"\n",
325    "df3 = pd.read_csv(io.StringIO(ss))\n",
326    "df_12y = df3[[\"e2i\", \"nei\", \"c2i\", \"nci\"]]\n",
327    "# TODO: currently 1 is reference, switch labels\n",
328    "count1, nobs1, count2, nobs2 = df_12y.values.T\n",
329    "dta = df_12y.values.T"
330   ]
331  },
332  {
333   "cell_type": "code",
334   "execution_count": null,
335   "metadata": {},
336   "outputs": [],
337   "source": [
338    "eff, var_eff = effectsize_2proportions(*dta, statistic=\"rd\")"
339   ]
340  },
341  {
342   "cell_type": "code",
343   "execution_count": null,
344   "metadata": {},
345   "outputs": [],
346   "source": [
347    "eff, var_eff"
348   ]
349  },
350  {
351   "cell_type": "code",
352   "execution_count": null,
353   "metadata": {},
354   "outputs": [],
355   "source": [
356    "res5 = combine_effects(\n",
357    "    eff, var_eff, method_re=\"iterated\", use_t=False\n",
358    ")  # , row_names=rownames)\n",
359    "res5_df = res5.summary_frame()\n",
360    "print(\"method RE:\", res5.method_re)\n",
361    "print(\"RE variance tau2:\", res5.tau2)\n",
362    "print(res5.summary_frame())\n",
363    "fig = res5.plot_forest()\n",
364    "fig.set_figheight(8)\n",
365    "fig.set_figwidth(6)"
366   ]
367  },
368  {
369   "cell_type": "markdown",
370   "metadata": {},
371   "source": [
372    "### changing data to have positive random effects variance"
373   ]
374  },
375  {
376   "cell_type": "code",
377   "execution_count": null,
378   "metadata": {},
379   "outputs": [],
380   "source": [
381    "dta_c = dta.copy()\n",
382    "dta_c.T[0, 0] = 18\n",
383    "dta_c.T[1, 0] = 22\n",
384    "dta_c.T"
385   ]
386  },
387  {
388   "cell_type": "code",
389   "execution_count": null,
390   "metadata": {},
391   "outputs": [],
392   "source": [
393    "eff, var_eff = effectsize_2proportions(*dta_c, statistic=\"rd\")\n",
394    "res5 = combine_effects(\n",
395    "    eff, var_eff, method_re=\"iterated\", use_t=False\n",
396    ")  # , row_names=rownames)\n",
397    "res5_df = res5.summary_frame()\n",
398    "print(\"method RE:\", res5.method_re)\n",
399    "print(res5.summary_frame())\n",
400    "fig = res5.plot_forest()\n",
401    "fig.set_figheight(8)\n",
402    "fig.set_figwidth(6)"
403   ]
404  },
405  {
406   "cell_type": "code",
407   "execution_count": null,
408   "metadata": {},
409   "outputs": [],
410   "source": [
411    "res5 = combine_effects(eff, var_eff, method_re=\"chi2\", use_t=False)\n",
412    "res5_df = res5.summary_frame()\n",
413    "print(\"method RE:\", res5.method_re)\n",
414    "print(res5.summary_frame())\n",
415    "fig = res5.plot_forest()\n",
416    "fig.set_figheight(8)\n",
417    "fig.set_figwidth(6)"
418   ]
419  },
420  {
421   "cell_type": "markdown",
422   "metadata": {},
423   "source": [
424    "### Replicate fixed effect analysis using GLM with var_weights\n",
425    "\n",
426    "`combine_effects` computes weighted average estimates which can be replicated using GLM with var_weights or with WLS.\n",
427    "The `scale` option in `GLM.fit` can be used to replicate fixed meta-analysis with fixed and with HKSJ/WLS scale"
428   ]
429  },
430  {
431   "cell_type": "code",
432   "execution_count": null,
433   "metadata": {},
434   "outputs": [],
435   "source": [
436    "from statsmodels.genmod.generalized_linear_model import GLM"
437   ]
438  },
439  {
440   "cell_type": "code",
441   "execution_count": null,
442   "metadata": {},
443   "outputs": [],
444   "source": [
445    "eff, var_eff = effectsize_2proportions(*dta_c, statistic=\"or\")\n",
446    "res = combine_effects(eff, var_eff, method_re=\"chi2\", use_t=False)\n",
447    "res_frame = res.summary_frame()\n",
448    "print(res_frame.iloc[-4:])"
449   ]
450  },
451  {
452   "cell_type": "markdown",
453   "metadata": {},
454   "source": [
455    "We need to fix scale=1 in order to replicate standard errors for the usual meta-analysis."
456   ]
457  },
458  {
459   "cell_type": "code",
460   "execution_count": null,
461   "metadata": {},
462   "outputs": [],
463   "source": [
464    "weights = 1 / var_eff\n",
465    "mod_glm = GLM(eff, np.ones(len(eff)), var_weights=weights)\n",
466    "res_glm = mod_glm.fit(scale=1.0)\n",
467    "print(res_glm.summary().tables[1])"
468   ]
469  },
470  {
471   "cell_type": "code",
472   "execution_count": null,
473   "metadata": {},
474   "outputs": [],
475   "source": [
476    "# check results\n",
477    "res_glm.scale, res_glm.conf_int() - res_frame.loc[\n",
478    "    \"fixed effect\", [\"ci_low\", \"ci_upp\"]\n",
479    "].values"
480   ]
481  },
482  {
483   "cell_type": "markdown",
484   "metadata": {},
485   "source": [
486    "Using HKSJ variance adjustment in meta-analysis is equivalent to estimating the scale using pearson chi2, which is also the default for the gaussian family."
487   ]
488  },
489  {
490   "cell_type": "code",
491   "execution_count": null,
492   "metadata": {},
493   "outputs": [],
494   "source": [
495    "res_glm = mod_glm.fit(scale=\"x2\")\n",
496    "print(res_glm.summary().tables[1])"
497   ]
498  },
499  {
500   "cell_type": "code",
501   "execution_count": null,
502   "metadata": {},
503   "outputs": [],
504   "source": [
505    "# check results\n",
506    "res_glm.scale, res_glm.conf_int() - res_frame.loc[\n",
507    "    \"fixed effect\", [\"ci_low\", \"ci_upp\"]\n",
508    "].values"
509   ]
510  },
511  {
512   "cell_type": "markdown",
513   "metadata": {},
514   "source": [
515    "### Mantel-Hanszel odds-ratio using contingency tables\n",
516    "\n",
517    "The fixed effect for the log-odds-ratio using the Mantel-Hanszel can be directly computed using StratifiedTable.\n",
518    "\n",
519    "We need to create a 2 x 2 x k contingency table to be used with `StratifiedTable`."
520   ]
521  },
522  {
523   "cell_type": "code",
524   "execution_count": null,
525   "metadata": {},
526   "outputs": [],
527   "source": [
528    "t, nt, c, nc = dta_c\n",
529    "counts = np.column_stack([t, nt - t, c, nc - c])\n",
530    "ctables = counts.T.reshape(2, 2, -1)\n",
531    "ctables[:, :, 0]"
532   ]
533  },
534  {
535   "cell_type": "code",
536   "execution_count": null,
537   "metadata": {},
538   "outputs": [],
539   "source": [
540    "counts[0]"
541   ]
542  },
543  {
544   "cell_type": "code",
545   "execution_count": null,
546   "metadata": {},
547   "outputs": [],
548   "source": [
549    "dta_c.T[0]"
550   ]
551  },
552  {
553   "cell_type": "code",
554   "execution_count": null,
555   "metadata": {},
556   "outputs": [],
557   "source": [
558    "import statsmodels.stats.api as smstats"
559   ]
560  },
561  {
562   "cell_type": "code",
563   "execution_count": null,
564   "metadata": {},
565   "outputs": [],
566   "source": [
567    "st = smstats.StratifiedTable(ctables.astype(np.float64))"
568   ]
569  },
570  {
571   "cell_type": "markdown",
572   "metadata": {},
573   "source": [
574    "compare pooled log-odds-ratio and standard error to R meta package"
575   ]
576  },
577  {
578   "cell_type": "code",
579   "execution_count": null,
580   "metadata": {},
581   "outputs": [],
582   "source": [
583    "st.logodds_pooled, st.logodds_pooled - 0.4428186730553189  # R meta"
584   ]
585  },
586  {
587   "cell_type": "code",
588   "execution_count": null,
589   "metadata": {},
590   "outputs": [],
591   "source": [
592    "st.logodds_pooled_se, st.logodds_pooled_se - 0.08928560091027186  # R meta"
593   ]
594  },
595  {
596   "cell_type": "code",
597   "execution_count": null,
598   "metadata": {},
599   "outputs": [],
600   "source": [
601    "st.logodds_pooled_confint()"
602   ]
603  },
604  {
605   "cell_type": "code",
606   "execution_count": null,
607   "metadata": {},
608   "outputs": [],
609   "source": [
610    "print(st.test_equal_odds())"
611   ]
612  },
613  {
614   "cell_type": "code",
615   "execution_count": null,
616   "metadata": {},
617   "outputs": [],
618   "source": [
619    "print(st.test_null_odds())"
620   ]
621  },
622  {
623   "cell_type": "markdown",
624   "metadata": {},
625   "source": [
626    "check conversion to stratified contingency table\n",
627    "\n",
628    "Row sums of each table are the sample sizes for treatment and control experiments"
629   ]
630  },
631  {
632   "cell_type": "code",
633   "execution_count": null,
634   "metadata": {},
635   "outputs": [],
636   "source": [
637    "ctables.sum(1)"
638   ]
639  },
640  {
641   "cell_type": "code",
642   "execution_count": null,
643   "metadata": {},
644   "outputs": [],
645   "source": [
646    "nt, nc"
647   ]
648  },
649  {
650   "cell_type": "markdown",
651   "metadata": {},
652   "source": [
653    "**Results from R meta package**\n",
654    "\n",
655    "```\n",
656    "> res_mb_hk = metabin(e2i, nei, c2i, nci, data=dat2, sm=\"OR\", Q.Cochrane=FALSE, method=\"MH\", method.tau=\"DL\", hakn=FALSE, backtransf=FALSE)\n",
657    "> res_mb_hk\n",
658    "     logOR            95%-CI %W(fixed) %W(random)\n",
659    "1   2.7081 [ 0.5265; 4.8896]       0.3        0.7\n",
660    "2   1.2567 [ 0.2658; 2.2476]       2.1        3.2\n",
661    "3   0.3749 [-0.3911; 1.1410]       5.4        5.4\n",
662    "4   1.6582 [ 0.3245; 2.9920]       0.9        1.8\n",
663    "5   0.7850 [-0.0673; 1.6372]       3.5        4.4\n",
664    "6   0.3617 [-0.1528; 0.8762]      12.1       11.8\n",
665    "7   0.5754 [-0.3861; 1.5368]       3.0        3.4\n",
666    "8   0.2505 [-0.4881; 0.9892]       6.1        5.8\n",
667    "9   0.6506 [-0.3877; 1.6889]       2.5        3.0\n",
668    "10  0.0918 [-0.8067; 0.9903]       4.5        3.9\n",
669    "11  0.2739 [-0.1047; 0.6525]      23.1       21.4\n",
670    "12  0.4858 [ 0.0804; 0.8911]      18.6       18.8\n",
671    "13  0.1823 [-0.6830; 1.0476]       4.6        4.2\n",
672    "14  0.9808 [-0.4178; 2.3795]       1.3        1.6\n",
673    "15  1.3122 [-1.0055; 3.6299]       0.4        0.6\n",
674    "16 -0.2595 [-1.4450; 0.9260]       3.1        2.3\n",
675    "17  0.1384 [-0.5076; 0.7844]       8.5        7.6\n",
676    "\n",
677    "Number of studies combined: k = 17\n",
678    "\n",
679    "                      logOR           95%-CI    z  p-value\n",
680    "Fixed effect model   0.4428 [0.2678; 0.6178] 4.96 < 0.0001\n",
681    "Random effects model 0.4295 [0.2504; 0.6086] 4.70 < 0.0001\n",
682    "\n",
683    "Quantifying heterogeneity:\n",
684    " tau^2 = 0.0017 [0.0000; 0.4589]; tau = 0.0410 [0.0000; 0.6774];\n",
685    " I^2 = 1.1% [0.0%; 51.6%]; H = 1.01 [1.00; 1.44]\n",
686    "\n",
687    "Test of heterogeneity:\n",
688    "     Q d.f. p-value\n",
689    " 16.18   16  0.4404\n",
690    "\n",
691    "Details on meta-analytical method:\n",
692    "- Mantel-Haenszel method\n",
693    "- DerSimonian-Laird estimator for tau^2\n",
694    "- Jackson method for confidence interval of tau^2 and tau\n",
695    "\n",
696    "> res_mb_hk$TE.fixed\n",
697    "[1] 0.4428186730553189\n",
698    "> res_mb_hk$seTE.fixed\n",
699    "[1] 0.08928560091027186\n",
700    "> c(res_mb_hk$lower.fixed, res_mb_hk$upper.fixed)\n",
701    "[1] 0.2678221109331694 0.6178152351774684\n",
702    " \n",
703    "```\n"
704   ]
705  },
706  {
707   "cell_type": "code",
708   "execution_count": null,
709   "metadata": {},
710   "outputs": [],
711   "source": [
712    "print(st.summary())"
713   ]
714  }
715 ],
716 "metadata": {
717  "kernelspec": {
718   "display_name": "Python 3",
719   "language": "python",
720   "name": "python3"
721  },
722  "language_info": {
723   "codemirror_mode": {
724    "name": "ipython",
725    "version": 3
726   },
727   "file_extension": ".py",
728   "mimetype": "text/x-python",
729   "name": "python",
730   "nbconvert_exporter": "python",
731   "pygments_lexer": "ipython3",
732   "version": "3.8.10"
733  }
734 },
735 "nbformat": 4,
736 "nbformat_minor": 4
737}
738