Skip to content

Commit

Permalink
Merge pull request #28 from msrosenberg/dev-branch
Browse files Browse the repository at this point in the history
Publication Bias Reorg
  • Loading branch information
msrosenberg authored Jul 5, 2023
2 parents 79d82e7 + 84ce282 commit 270307f
Show file tree
Hide file tree
Showing 23 changed files with 2,815 additions and 897 deletions.
6 changes: 6 additions & 0 deletions MetaWin_mac.spec
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ added_files = [("resources/images/[email protected]", "resources/images"),
("resources/images/analysis_regression1.png", "resources/images"),
("resources/images/analysis_regression2.png", "resources/images"),
("resources/images/metacalc.png", "resources/images"),
("resources/images/example_egger.png", "resources/images"),
("resources/images/pubbias_egger.png", "resources/images"),
("resources/images/example_funnel1.png", "resources/images"),
("resources/images/example_funnel2.png", "resources/images"),
("resources/images/example_funnel3.png", "resources/images"),
("resources/images/pubbias_funnel.png", "resources/images"),

("resources/metawin.css", "resources"),
("resources/metacalc_help.html", "resources"),
Expand Down
6 changes: 6 additions & 0 deletions MetaWin_windows.spec
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ added_files = [("resources/images/[email protected]", "resources/images"),
("resources/images/analysis_regression1.png", "resources/images"),
("resources/images/analysis_regression2.png", "resources/images"),
("resources/images/metacalc.png", "resources/images"),
("resources/images/example_egger.png", "resources/images"),
("resources/images/pubbias_egger.png", "resources/images"),
("resources/images/example_funnel1.png", "resources/images"),
("resources/images/example_funnel2.png", "resources/images"),
("resources/images/example_funnel3.png", "resources/images"),
("resources/images/pubbias_funnel.png", "resources/images"),

("resources/metawin.css", "resources"),
("resources/metacalc_help.html", "resources"),
Expand Down
Binary file modified resources/images/analysis_dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/example_egger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/example_funnel1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/example_funnel2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/example_funnel3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/pubbias_egger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/pubbias_funnel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
597 changes: 401 additions & 196 deletions resources/metawin_help.html

Large diffs are not rendered by default.

357 changes: 78 additions & 279 deletions src/MetaWinAnalysis.py

Large diffs are not rendered by default.

655 changes: 328 additions & 327 deletions src/MetaWinAnalysisFunctions.py

Large diffs are not rendered by default.

498 changes: 457 additions & 41 deletions src/MetaWinCharts.py

Large diffs are not rendered by default.

31 changes: 28 additions & 3 deletions src/MetaWinConstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

MAJOR_VERSION = 3
MINOR_VERSION = 0
PATCH_VERSION = 13
PATCH_VERSION = 14

# validity check when fetching value from data matrix
VALUE_NUMBER = 0
Expand Down Expand Up @@ -87,8 +87,7 @@ def resource_path(relative_path: str, inc_file: bool = False) -> str:
english_icon = resource_path(icon_path + "[email protected]")
spanish_icon = resource_path(icon_path + "[email protected]")
color_swatch_icon = resource_path(icon_path + "[email protected]")
# in anticipation of a new section
# pub_bias_icon = resource_path(icon_path + "[email protected]")
pub_bias_icon = resource_path(icon_path + "[email protected]")

metawin_icon = resource_path(icon_path + "metawin3toolbar_icon.png")
metawin_splash = resource_path(icon_path + "metawin3splash_square.png")
Expand All @@ -103,8 +102,10 @@ def resource_path(relative_path: str, inc_file: bool = False) -> str:
"basic_analysis": resource_path(doc_path + "metawin_help.html#basic_analysis", True),
"cumulative_analysis": resource_path(doc_path + "metawin_help.html#cumulative_analysis", True),
"effect_sizes": resource_path(doc_path + "metawin_help.html#effect_sizes", True),
"egger_regression": resource_path(doc_path + "metawin_help.html#egger_regression", True),
"filtering_data": resource_path(doc_path + "metawin_help.html#filtering_data", True),
"forest_plot": resource_path(doc_path + "metawin_help.html#forest_plot", True),
"funnel_plot": resource_path(doc_path + "metawin_help.html#funnel_plot", True),
"galbraith_plot": resource_path(doc_path + "metawin_help.html#galbraith_plot", True),
"glm_analysis": resource_path(doc_path + "metawin_help.html#glm_analysis", True),
"graph_edit": resource_path(doc_path + "metawin_help.html#graph_edit", True),
Expand Down Expand Up @@ -213,6 +214,10 @@ def resource_path(relative_path: str, inc_file: bool = False) -> str:
"Kendall_1938": ["Kendall, M. (1938) A new measure of rank correlation. <em>Biometrika</em>. "
"30(1&ndash;2):81&ndash;89.", "Kendall (1938)", "10.1093/biomet/30.1-2.81"],

"Kossmeier_et_2020": ["Kossmeier, M., U.S. Tran, and M. Voracek (2020) Power-enhanced funnel plots for "
"meta-analysis: The sunset funnel plot. <em>Zeitschrift für Psychologie</em> "
"228(1):43&ndash;49.", "Kossmeier <em>et al.</em> (2020)", "10.1027/2151-2604/a000392"],

"LAbbe_et_1987": ["L&rsquo;Abbé, K.A., A.S. Detsky, and K. O&rsquo;Rourke (1987) Meta-analysis in clinical "
"research. <em>Annals of Internal Medicine</em> 107:224&ndash;233.",
"L&rsquo;Abbé <em>et al.</em> (1987)", "10.7326/0003-4819-107-2-224"],
Expand All @@ -226,6 +231,12 @@ def resource_path(relative_path: str, inc_file: bool = False) -> str:
"Press: Princeton, NJ.</span></li>", "Lajeunesse <em>et al.</em> (2013)",
"10.23943/princeton/9780691137285.003.0017"],

"Light_Pillemer_1984": ["Light, R.J., and D.B. Pillemer (1984) <em>Summing Up: The Science of Reviewing "
"Research</em>. Harvard University Press: Cambridge.", "Light and Pillemer (1984)", ""],

"Lin_Chu_2018": ["Lin, L., and H. Chu (2018) Quantifying publication bias in meta-analysis. <em>Biometrics</em> "
"74(3):785&ndash;794.", "Lin and Chu (2018)", "10.1111/biom.12817"],

"Mantel_and_Haenszel_1959": ["Mantel, N., and W. Haenszel (1959) Statistical aspects of the analysis of data "
"from retrospective studies of disease. <em>Journal of the National Cancer "
"Institute</em> 22:719&ndash;748.", "Mantel and Haenszel (1959)",
Expand All @@ -237,13 +248,23 @@ def resource_path(relative_path: str, inc_file: bool = False) -> str:
"Princeton University Press: Princeton, NJ.", "Mengersen and Gurevitch (2013)",
"10.23943/princeton/9780691137285.003.0007"],

"Nakagawa_et_2022": ["Nakagawa, S., M. Lagisz, M.D. Jennions, J. Koricheva, D.W.A. Noble, T.H. Parker, A. "
"Sánchez-Tójar, Y. Yang, and R.E. O'Dea (2022) Methods for testing publication bias in "
"ecological and evolutionary meta-analyses. <em>Methods in Ecology and Evolution</em> "
"13(1):4&ndash;21.", "Nakagawa <em>et al.</em> (2022)", "10.1111/2041-210X.13724"],

"Normand_1999": ["Normand, S.-L.T. (1999) Meta-analysis: Formulating, evaluating, combining, and reporting. "
"<em>Statistics in Medicine</em> 18:321&mdash;359.", "Normand (1999)",
"10.1002/(SICI)1097-0258(19990215)18:3<321::AID-SIM28>3.0.CO;2-P"],

"Orwin_1983": ["Orwin, R.G. (1983) A fail-safe <em>N</em> for effect size in meta-analysis. <em>Journal of "
"Educational Statistics</em> 8(2):157&ndash;159.", "Orwin (1983)", "10.2307/1164923"],

"Peters_et_2008": ["Peters, J.L., A.J. Sutton, D.R. Jones, K.R. Abrams, and L. Rushton (2008) Contour-enhanced "
"meta-analysis funnel plots help distinguish publication bias from other causes of asymmetry. "
"<em>Journal of Clinical Epidemiology</em> 61(10):991&ndash;996.",
"Peters <em>et al.</em> (2008)", "10.1016/j.jclinepi.2007.11.010"],

"Rosenberg_et_2000": ["Rosenberg, M.S., D.C. Adams, and J. Gurevitch (2000) <em>MetaWin: Statistical Software "
"for Meta-analysis</em>. Sinauer Associates, Sunderland, MA.",
"Rosenberg <em>et al.</em> (2000)", ""],
Expand All @@ -270,6 +291,10 @@ def resource_path(relative_path: str, inc_file: bool = False) -> str:
"Spearman_1904": ["Spearman C. (1904) The proof and measurement of association between two things. <em>American "
"Journal of Psychology</em>. 15(1):72&ndash;101.", "Spearman (1904)", "10.2307/1412159"],

"Sterne_Egger_2001": ["Sterne, J.A.C., and M. Egger (2001) Funnel plots for detecting bias in meta-analysis: "
"Guidelines on choice of axis. <em>Journal of Clinical Epidemiology</em> "
"54(10):1045&ndash;1055.", "Sterne and Egger (2001)", "10.1016/S0895-4356(01)00377-8"],

"Wang_and_Bushman_1998": ["Wang, M.C., and B.J. Bushman (1998) Using the normal quantile plot to explore "
"meta-analytic data sets. <em>Psychological Methods</em> 3:46&ndash;54.",
"Wang and Bushman (1998)", "10.1037/1082-989X.3.1.46"]
Expand Down
52 changes: 27 additions & 25 deletions src/MetaWinDraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"""
import webbrowser
import math
from typing import Tuple

from PyQt6.QtWidgets import QDialog, QLabel, QVBoxLayout, QFrame, QComboBox, QGroupBox, QLineEdit, QRadioButton, \
QGridLayout
Expand All @@ -24,6 +23,7 @@
from MetaWinWidgets import add_ok_cancel_help_button_layout, add_effect_choice_to_dialog
import MetaWinCharts
from MetaWinLanguage import get_text
from MetaWinUtils import calculate_regression


class MetaAnalysisDrawScatterDialog(QDialog):
Expand All @@ -38,7 +38,7 @@ def __init__(self, data: MetaWinData):
def init_ui(self, data: MetaWinData):
button_layout, _ = add_ok_cancel_help_button_layout(self)

draw_label = QLabel(get_text("Scatter/Funnel Plot"))
draw_label = QLabel(get_text("Scatter Plot"))
draw_label.setStyleSheet(MetaWinConstants.title_label_style)

self.columns = data.cols
Expand All @@ -50,7 +50,7 @@ def init_ui(self, data: MetaWinData):
self.y_box.addItem(col.label)
x_label = QLabel(get_text("Data for X-axis"))
y_label = QLabel(get_text("Data for Y-axis"))
info_label = QLabel(get_text("note_funnel_plot"))
# info_label = QLabel(get_text("note_funnel_plot"))

options_layout = QVBoxLayout()
options_layout.addWidget(x_label)
Expand All @@ -66,12 +66,12 @@ def init_ui(self, data: MetaWinData):
main_layout = QVBoxLayout()
main_layout.addWidget(draw_label)
main_layout.addWidget(main_frame)
main_layout.addWidget(info_label)
# main_layout.addWidget(info_label)
main_layout.addLayout(button_layout)

self.setLayout(main_layout)
self.setWindowIcon(QIcon(MetaWinConstants.metawin_icon))
self.setWindowTitle(get_text("Scatter/Funnel Plot"))
self.setWindowTitle(get_text("Scatter Plot"))

def show_help(self):
webbrowser.open(self.help)
Expand Down Expand Up @@ -342,11 +342,13 @@ def ok_clicked(self):
if not self.chart_data.suppress_y:
self.chart_data.y_label = self.y_box.text()
for edit_panel in self.panel_list:
if edit_panel.isChecked():
edit_panel.data.visible = True
edit_panel.data.update_style()
else:
edit_panel.data.visible = False
edit_panel.data.visible = edit_panel.isChecked()
edit_panel.data.update_style()
# if edit_panel.isChecked():
# edit_panel.data.visible = True
# edit_panel.data.update_style()
# else:
# edit_panel.data.visible = False
self.accept()


Expand Down Expand Up @@ -387,20 +389,20 @@ def draw_scatter_dialog(sender, data):
return None


def calculate_regression(x: numpy.array, y: numpy.array) -> Tuple[float, float]:
"""
Basic linear regression of y vs x, returning slope and intercept
"""
n = len(x)
sum_y = numpy.sum(y)
sum_x = numpy.sum(x)
mean_y = sum_y/n
mean_x = sum_x/n
sum_x2 = numpy.sum(numpy.square(x))
sum_xy = numpy.sum(x*y)
slope = (n*sum_xy - sum_x*sum_y)/(n*sum_x2 - sum_x**2)
intercept = mean_y - slope*mean_x
return slope, intercept
# def calculate_regression(x: numpy.array, y: numpy.array) -> Tuple[float, float]:
# """
# Basic linear regression of y vs x, returning slope and intercept
# """
# n = len(x)
# sum_y = numpy.sum(y)
# sum_x = numpy.sum(x)
# mean_y = sum_y/n
# mean_x = sum_x/n
# sum_x2 = numpy.sum(numpy.square(x))
# sum_xy = numpy.sum(x*y)
# slope = (n*sum_xy - sum_x*sum_y)/(n*sum_x2 - sum_x**2)
# intercept = mean_y - slope*mean_x
# return slope, intercept


def draw_normal_quantile_plot(data, e_data_col, v_data_col, alpha: float = 0.05):
Expand All @@ -425,7 +427,7 @@ def draw_normal_quantile_plot(data, e_data_col, v_data_col, alpha: float = 0.05)

x_data = numpy.array(x_data)
y_data = numpy.array(y_data)
slope, intercept = calculate_regression(x_data, y_data)
slope, intercept, _, _ = calculate_regression(x_data, y_data)

return MetaWinCharts.chart_normal_quantile(get_text("Normal Quantile"), get_text("Standardized Effect Size"),
x_data, y_data, slope, intercept, alpha)
Expand Down
Loading

0 comments on commit 270307f

Please sign in to comment.