Skip to content

Commit

Permalink
Merge pull request #4 from msrosenberg/dev-branch
Browse files Browse the repository at this point in the history
Dev branch
  • Loading branch information
msrosenberg authored Sep 6, 2022
2 parents fe144cf + 28bfc02 commit 75022af
Show file tree
Hide file tree
Showing 11 changed files with 196 additions and 85 deletions.
1 change: 1 addition & 0 deletions MetaWin_mac.spec
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ added_files = [("resources/images/[email protected]", "resources/images"),
("resources/images/[email protected]", "resources/images"),
("resources/images/[email protected]", "resources/images"),
("resources/images/[email protected]", "resources/images"),
("resources/images/[email protected]", "resources/images"),

("resources/images/metawin3icon.png", "resources/images"),
("resources/images/draw_forest.png", "resources/images"),
Expand Down
1 change: 1 addition & 0 deletions MetaWin_windows.spec
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ added_files = [("resources/images/[email protected]", "resources/images"),
("resources/images/[email protected]", "resources/images"),
("resources/images/[email protected]", "resources/images"),
("resources/images/[email protected]", "resources/images"),
("resources/images/[email protected]", "resources/images"),

("resources/images/metawin3icon.png", "resources/images"),
("resources/images/draw_forest.png", "resources/images"),
Expand Down
Binary file added resources/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 46 additions & 16 deletions resources/metawin_help.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ <h1>Help Table of Contents</h1>
</ul>
</li>
<li><a href="#phylogeny_tab">Phylogeny Tab</a></li>
<li><a href="#analysis_options">Analysis Options</a></li>
<li><a href="#additional_options">Additional Options</a></li>
</ul>
</li>
Expand Down Expand Up @@ -353,21 +354,6 @@ <h4>Decimal Places</h4>
places used to display these values is automatically determined by the software based on the number of desired
replicates.</p>

<h4 id="alpha_level">Significance Level</h4>
<p>By default, significance levels for generating confidence intervals and certain types of tests are
based on a standard value of 5% (&alpha; = 0.05). This value can be changed by
choosing <span class="menu">Significance Level</span> from the
<span class="menu">Options&rarr;Output Options</span> menu or
<img class="toolbar-button" src="images/[email protected]"/> from the toolbar on the
left side of the Output Tab. Valid options are numbers between 0.01 and 1.0).
Note that changing this value will
only affect future output; vales already computed will not be changed. If you change the significance
level to use in the output, <span class="metawin">MetaWin</span> will attempt to remember this
choice the next time you run the program.</p>
<p>This choice also effects a few of the direct figures you can draw, such as
<a href="#forest_plot">Forest Plots</a>
and <a href="#normal_quantile_plot">Normal Quantile Plots</a>.</p>

<h4>Font</h4>
<p>You can change the font and it's properties used in the Output Tab by choosing
<span class="menu">Font</span> from the
Expand Down Expand Up @@ -470,6 +456,40 @@ <h2 id="phylogeny_tab">Phylogeny Tab</h2>
Meta-Analysis</a> option becomes available.
</p>

<h2 id="analysis_options">Analysis Options</h2>
<h4 id="alpha_level">Significance Level</h4>
<p>By default, significance levels for generating confidence intervals and certain types of tests are
based on a standard value of 5% (&alpha; = 0.05). This value can be changed by
choosing <span class="menu">Significance Level</span> from the
<span class="menu">Options&rarr;Analysis Options</span> menu or
<img class="toolbar-button" src="images/[email protected]"/> from the toolbar on the
left side of the Output Tab. Valid options are numbers between 0.01 and 1.0).
Note that changing this value will
only affect future output; vales already computed will not be changed. If you change the significance
level to use in the output, <span class="metawin">MetaWin</span> will attempt to remember this
choice the next time you run the program.</p>
<p>This choice also effects a few of the direct figures you can draw, such as
<a href="#forest_plot">Forest Plots</a>
and <a href="#normal_quantile_plot">Normal Quantile Plots</a>.</p>

<h4 id="ci_distribution">Confidence Interval Distribution</h4>
<p>When determining confidence intervals around means using standard distributions (rather than a
boostrap procedure), the traditional approach in meta-analysis has generally been to use a Normal
distribution. In earlier versions of <span class="metawin">MetaWin</span>, we used Student's <em>t</em>
distribution instead, because we thought it useful to account for the uncertainty in estimation due
to the small number of studies often found in meta-analyses. With this new version, the user can
specify which distribution they wish to use, with the Normal distribution set as default.
</p>
<p>To change the distribution, choose the item under the
<span class="menu">Options&rarr;Analysis Options</span> menu, which will toggle between the two
distributions. The current distribution is indicated by the icon to the left of the menu option
(either a <em><strong>Z</strong></em> or a <em><strong>t</strong></em>), as well as by the text
of the menu item which specifies the distributions being changed both "from" and "to".
<span class="metawin">MetaWin</span> will attempt to remember this choice the next time you run the
program.</p>
<p>The specified distribution is also listed as one of the user-specified parameters at the beginning of
analysis output.</p>

<h2 id="additional_options">Additional Options</h2>

<h3 id="updates">Check for Updates</h3>
Expand Down Expand Up @@ -889,6 +909,7 @@ <h3>Output</h3>
→ Fixed Effects Model
</p>
<p>
→ Standard confidence intervals around means based on Normal distribution<br />
→ Use bootstrap for confidence intervals around means: 999 iterations<br />
→ Citations: Adams <em>et al.</em> (1997), Dixon (1993)
</p>
Expand Down Expand Up @@ -1119,6 +1140,9 @@ <h3>Output</h3>
→ Fixed Effects Model
</p>
<p>
→ Standard confidence intervals around means based on Normal distribution
</p>
<p>
85 studies will be included in this analysis
</p>
<p>
Expand Down Expand Up @@ -1194,6 +1218,7 @@ <h3>Output</h3>
→ Fixed Effects Model
</p>
<p>
→ Standard confidence intervals around means based on Normal distribution<br />
→ Use bootstrap for confidence intervals around means: 999 iterations<br/>
→ Citations: Adams <em>et al.</em> (1997), Dixon (1993)
</p>
Expand Down Expand Up @@ -1371,6 +1396,7 @@ <h3>Output</h3>
→ Fixed Effects Model
</p>
<p>
→ Standard confidence intervals around means based on Normal distribution<br />
→ Use bootstrap for confidence intervals around means: 999 iterations<br/>
→ Citations: Adams <em>et al.</em> (1997), Dixon (1993)
</p>
Expand Down Expand Up @@ -1577,6 +1603,7 @@ <h3>Output</h3>
→ Fixed Effects Model
</p>
<p>
→ Standard confidence intervals around means based on Normal distribution<br />
→ Use bootstrap for confidence intervals around means: 999 iterations<br/>
→ Citations: Adams <em>et al.</em> (1997), Dixon (1993)
</p>
Expand Down Expand Up @@ -1768,6 +1795,7 @@ <h3>Output</h3>
→ Citations: Adams <em>et al.</em> (1997), Dixon (1993)
</p>
<p>
→ Standard confidence intervals around means based on Normal distribution<br />
→ Use randomization to test model structure: 999 iterations<br/>
→ Citation: Adams <em>et al.</em> (1997)
</p>
Expand Down Expand Up @@ -1987,6 +2015,7 @@ <h3>Output</h3>
→ Fixed Effects Model
</p>
<p>
→ Standard confidence intervals around means based on Normal distribution<br />
→ Use bootstrap for confidence intervals around means: 999 iterations<br/>
→ Citations: Adams <em>et al.</em> (1997), Dixon (1993)
</p>
Expand Down Expand Up @@ -2216,6 +2245,7 @@ <h3>Output</h3>
→ Fixed Effects Model
</p>
<p>
→ Standard confidence intervals around means based on Normal distribution<br />
→ Use bootstrap for confidence intervals around means: 999 iterations<br/>
→ Citations: Adams <em>et al.</em> (1997), Dixon (1993)
</p>
Expand Down Expand Up @@ -2559,7 +2589,7 @@ <h1 id="references">References</h1>
analysis of data from retrospective studies of disease. <em>Journal of the National Cancer
Institute</em> 22:719&ndash;748.</span></li>
<li><span id="mengersen_gurevitch_2013">Mengersen, K., and J. Gurevitch (2013)
Using other Metricsmof effect size in meta-analysis. Pp. 72&ndash;85 in <em>Handbook of
Using other metrics of effect size in meta-analysis. Pp. 72&ndash;85 in <em>Handbook of
Meta-analysis in Ecology and Evolution</em>, J. Koricheva, J. Gurevitch and K.L. Mengersen, eds.
Princeton University Press: Princeton, NJ.</span></li>
<li><span id="normand_1999">Normand, S.-L.T. (1999) Meta-analysis: Formulating, evaluating, combining,
Expand Down
52 changes: 34 additions & 18 deletions src/MetaWinAnalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(self):
self.create_graph = False
self.k_estimator = "L"
self.cor_test = "tau"
self.norm_ci = True

def report_choices(self):
output_blocks = []
Expand Down Expand Up @@ -168,14 +169,25 @@ def report_choices(self):
output.append("→ {}".format(get_text("Fixed Effects Model")))
output_blocks.append(output)

output = []
if self.norm_ci:
output.append("→ {}".format(get_text("ci from norm")))
else:
output.append("→ {}".format(get_text("ci from t")))
if self.bootstrap_mean is not None:
output_blocks.append(["→ {}: {} {}".format(get_text("Use bootstrap for confidence intervals around "
"means"), self.bootstrap_mean,
get_text("iterations")),
"→ {}: ".format(get_text("Citations")) + get_citation("Adams_et_1997") + ", " +
get_citation("Dixon_1993")])
output.extend(["→ {}: {} {}".format(get_text("Use bootstrap for confidence intervals around means"),
self.bootstrap_mean, get_text("iterations")),
"→ {}: ".format(get_text("Citations")) + get_citation("Adams_et_1997") + ", " +
get_citation("Dixon_1993")])
# output_blocks.append(["→ {}: {} {}".format(get_text("Use bootstrap for confidence intervals around "
# "means"), self.bootstrap_mean,
# get_text("iterations")),
# "→ {}: ".format(get_text("Citations")) + get_citation("Adams_et_1997") + ", " +
# get_citation("Dixon_1993")])
citations.append("Adams_et_1997")
citations.append("Dixon_1993")
output_blocks.append(output)

if self.structure == RANKCOR:
output_blocks.append(["→ {}: {} {}".format(get_text("Randomization to test correlation"),
self.randomize_model, get_text("iterations"))])
Expand Down Expand Up @@ -1773,56 +1785,60 @@ def add_resampling_options_to_dialog(sender, test_model: bool = False):
return randomization_group


def do_meta_analysis(data, options, decimal_places: int = 4, alpha: float = 0.05, tree: Optional = None):
def do_meta_analysis(data, options, decimal_places: int = 4, alpha: float = 0.05, tree: Optional = None,
norm_ci: bool = True):
"""
primary function controlling the execution of an analysis
based on specific options, farms out analysis to computational functions, then collects and returns
results
"""
output_blocks = [["<h2>{}</h2>".format(get_text("Analysis"))]]
options.norm_ci = norm_ci
output, all_citations = options.report_choices()
output_blocks.extend(output)
if options.structure == SIMPLE_MA:
(output, figure, fig_caption, chart_data, analysis_values,
citations) = MetaWinAnalysisFunctions.simple_meta_analysis(data, options, decimal_places, alpha)
citations) = MetaWinAnalysisFunctions.simple_meta_analysis(data, options, decimal_places, alpha, norm_ci)
elif options.structure == GROUPED_MA:
(output, figure, fig_caption, chart_data, analysis_values,
citations) = MetaWinAnalysisFunctions.grouped_meta_analysis(data, options, decimal_places, alpha)
citations) = MetaWinAnalysisFunctions.grouped_meta_analysis(data, options, decimal_places, alpha, norm_ci)
elif options.structure == CUMULATIVE_MA:
output, figure, fig_caption, chart_data = MetaWinAnalysisFunctions.cumulative_meta_analysis(data, options,
decimal_places,
alpha)
alpha, norm_ci)
analysis_values = None
citations = []
elif options.structure == REGRESSION_MA:
(output, figure, fig_caption, chart_data, analysis_values,
citations) = MetaWinAnalysisFunctions.regression_meta_analysis(data, options, decimal_places, alpha)
citations) = MetaWinAnalysisFunctions.regression_meta_analysis(data, options, decimal_places, alpha, norm_ci)
elif options.structure == COMPLEX_MA:
output, analysis_values, citations = MetaWinAnalysisFunctions.complex_meta_analysis(data, options,
decimal_places, alpha)
decimal_places, alpha,
norm_ci)
figure = None
fig_caption = None
chart_data = None
elif options.structure == NESTED_MA:
(output, figure, fig_caption, chart_data, analysis_values,
citations) = MetaWinAnalysisFunctions.nested_meta_analysis(data, options, decimal_places, alpha)
citations) = MetaWinAnalysisFunctions.nested_meta_analysis(data, options, decimal_places, alpha, norm_ci)
elif options.structure == TRIM_FILL:
(output, figure, fig_caption, chart_data, analysis_values,
citations) = MetaWinAnalysisFunctions.trim_and_fill_analysis(data, options, decimal_places, alpha)
citations) = MetaWinAnalysisFunctions.trim_and_fill_analysis(data, options, decimal_places, alpha, norm_ci)
elif options.structure == JACKKNIFE:
(output, figure, fig_caption,
chart_data, citations) = MetaWinAnalysisFunctions.jackknife_meta_analysis(data, options, decimal_places, alpha)
chart_data, citations) = MetaWinAnalysisFunctions.jackknife_meta_analysis(data, options, decimal_places,
alpha, norm_ci)
analysis_values = None
elif options.structure == PHYLOGENETIC_MA:
output, citations = MetaWinAnalysisFunctions.phylogenetic_meta_analysis(data, options, tree, decimal_places,
alpha)
alpha, norm_ci)
analysis_values = None
figure = None
fig_caption = None
chart_data = None
elif options.structure == RANKCOR:
output, citations = MetaWinAnalysisFunctions.rank_correlation_analysis(data, options, decimal_places, alpha)
output, citations = MetaWinAnalysisFunctions.rank_correlation_analysis(data, options, decimal_places)
figure = None
fig_caption = None
chart_data = None
Expand All @@ -1841,7 +1857,7 @@ def do_meta_analysis(data, options, decimal_places: int = 4, alpha: float = 0.05


def meta_analysis(sender, data, last_effect, last_var, decimal_places: int = 4, alpha: float = 0.05,
tree: Optional = None):
tree: Optional = None, norm_ci: bool = True):
"""
primary function for calling various dialogs to retrieve user choices about how to run various analyses
"""
Expand Down Expand Up @@ -1894,7 +1910,7 @@ def meta_analysis(sender, data, last_effect, last_var, decimal_places: int = 4,

if meta_analysis_options.structure is not None:
output, figure, fig_caption, chart_data, _ = do_meta_analysis(data, meta_analysis_options, decimal_places,
alpha, tree)
alpha, tree, norm_ci)
sender.last_effect = meta_analysis_options.effect_data
sender.last_var = meta_analysis_options.effect_vars
return output, figure, fig_caption, chart_data
Expand Down
Loading

0 comments on commit 75022af

Please sign in to comment.