R/jamovipdifftwo.h.R

Defines functions jamovipdifftwo

Documented in jamovipdifftwo

# This file is automatically generated, you probably don't want to edit this

jamovipdifftwoOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
    "jamovipdifftwoOptions",
    inherit = jmvcore::Options,
    public = list(
        initialize = function(
            switch = "from_raw",
            outcome_variable = NULL,
            grouping_variable = NULL,
            comparison_cases = " ",
            comparison_not_cases = " ",
            reference_cases = " ",
            reference_not_cases = " ",
            case_label = "Sick",
            not_case_label = "Well",
            grouping_variable_level1 = "Treated",
            grouping_variable_level2 = "Control",
            outcome_variable_name = "Outcome variable",
            grouping_variable_name = "Grouping variable",
            count_NA = FALSE,
            show_ratio = FALSE,
            show_chi_square = FALSE,
            chi_table_option = "both",
            show_phi = FALSE,
            conf_level = 95,
            show_details = FALSE,
            evaluate_hypotheses = FALSE,
            null_value = "0",
            null_boundary = "0",
            alpha = 0.05,
            null_color = "#A40122",
            es_plot_width = "400",
            es_plot_height = "450",
            ymin = "auto",
            ymax = "auto",
            ybreaks = "auto",
            ylab = "auto",
            xlab = "auto",
            axis.text.y = "14",
            axis.title.y = "15",
            axis.text.x = "14",
            axis.title.x = "15",
            simple_contrast_labels = TRUE,
            error_layout = "none",
            difference_axis_breaks = "auto",
            shape_summary_reference = "circle filled",
            shape_summary_comparison = "circle filled",
            shape_summary_difference = "triangle filled",
            color_summary_reference = "#008DF9",
            color_summary_comparison = "#009F81",
            color_summary_difference = "black",
            fill_summary_reference = "#008DF9",
            fill_summary_comparison = "#009F81",
            fill_summary_difference = "black",
            size_summary_reference = "4",
            size_summary_comparison = "4",
            size_summary_difference = "4",
            alpha_summary_reference = "1",
            alpha_summary_comparison = "1",
            alpha_summary_difference = "1",
            linetype_summary_reference = "solid",
            linetype_summary_comparison = "solid",
            linetype_summary_difference = "solid", ...) {

            super$initialize(
                package="esci",
                name="jamovipdifftwo",
                requiresData=TRUE,
                ...)

            private$..switch <- jmvcore::OptionList$new(
                "switch",
                switch,
                default="from_raw",
                options=list(
                    "from_raw",
                    "from_summary"))
            private$..outcome_variable <- jmvcore::OptionVariables$new(
                "outcome_variable",
                outcome_variable,
                suggested=list(
                    "nominal",
                    "ordinal"),
                permitted=list(
                    "factor"))
            private$..grouping_variable <- jmvcore::OptionVariable$new(
                "grouping_variable",
                grouping_variable,
                suggested=list(
                    "nominal",
                    "ordinal"),
                permitted=list(
                    "factor"))
            private$..comparison_cases <- jmvcore::OptionString$new(
                "comparison_cases",
                comparison_cases,
                default=" ")
            private$..comparison_not_cases <- jmvcore::OptionString$new(
                "comparison_not_cases",
                comparison_not_cases,
                default=" ")
            private$..reference_cases <- jmvcore::OptionString$new(
                "reference_cases",
                reference_cases,
                default=" ")
            private$..reference_not_cases <- jmvcore::OptionString$new(
                "reference_not_cases",
                reference_not_cases,
                default=" ")
            private$..case_label <- jmvcore::OptionString$new(
                "case_label",
                case_label,
                default="Sick")
            private$..not_case_label <- jmvcore::OptionString$new(
                "not_case_label",
                not_case_label,
                default="Well")
            private$..grouping_variable_level1 <- jmvcore::OptionString$new(
                "grouping_variable_level1",
                grouping_variable_level1,
                default="Treated")
            private$..grouping_variable_level2 <- jmvcore::OptionString$new(
                "grouping_variable_level2",
                grouping_variable_level2,
                default="Control")
            private$..outcome_variable_name <- jmvcore::OptionString$new(
                "outcome_variable_name",
                outcome_variable_name,
                default="Outcome variable")
            private$..grouping_variable_name <- jmvcore::OptionString$new(
                "grouping_variable_name",
                grouping_variable_name,
                default="Grouping variable")
            private$..count_NA <- jmvcore::OptionBool$new(
                "count_NA",
                count_NA,
                default=FALSE)
            private$..show_ratio <- jmvcore::OptionBool$new(
                "show_ratio",
                show_ratio,
                default=FALSE)
            private$..show_chi_square <- jmvcore::OptionBool$new(
                "show_chi_square",
                show_chi_square,
                default=FALSE)
            private$..chi_table_option <- jmvcore::OptionList$new(
                "chi_table_option",
                chi_table_option,
                options=list(
                    "observed",
                    "expected",
                    "both"),
                default="both")
            private$..show_phi <- jmvcore::OptionBool$new(
                "show_phi",
                show_phi,
                default=FALSE)
            private$..conf_level <- jmvcore::OptionNumber$new(
                "conf_level",
                conf_level,
                default=95)
            private$..show_details <- jmvcore::OptionBool$new(
                "show_details",
                show_details,
                default=FALSE)
            private$..evaluate_hypotheses <- jmvcore::OptionBool$new(
                "evaluate_hypotheses",
                evaluate_hypotheses,
                default=FALSE)
            private$..null_value <- jmvcore::OptionString$new(
                "null_value",
                null_value,
                default="0")
            private$..null_boundary <- jmvcore::OptionString$new(
                "null_boundary",
                null_boundary,
                default="0")
            private$..alpha <- jmvcore::OptionNumber$new(
                "alpha",
                alpha,
                default=0.05)
            private$..null_color <- jmvcore::OptionList$new(
                "null_color",
                null_color,
                default="#A40122",
                options=list(
                    "black",
                    "#00C2F9",
                    "#008DF9",
                    "#009F81",
                    "#FF5AAF",
                    "#9F0162",
                    "#A40122",
                    "#00FCCF",
                    "#FF6E3A",
                    "#FFB2FD",
                    "#8400CD",
                    "#E20134",
                    "#FFC33B",
                    "white",
                    "NA",
                    "NA",
                    "gray0",
                    "gray5",
                    "gray10",
                    "gray15",
                    "gray20",
                    "gray25",
                    "gray30",
                    "gray35",
                    "gray40",
                    "gray45",
                    "gray50",
                    "gray55",
                    "gray60",
                    "gray65",
                    "gray70",
                    "gray75",
                    "gray80",
                    "gray85",
                    "gray90",
                    "gray95",
                    "gray100"))
            private$..es_plot_width <- jmvcore::OptionString$new(
                "es_plot_width",
                es_plot_width,
                default="400")
            private$..es_plot_height <- jmvcore::OptionString$new(
                "es_plot_height",
                es_plot_height,
                default="450")
            private$..ymin <- jmvcore::OptionString$new(
                "ymin",
                ymin,
                default="auto")
            private$..ymax <- jmvcore::OptionString$new(
                "ymax",
                ymax,
                default="auto")
            private$..ybreaks <- jmvcore::OptionString$new(
                "ybreaks",
                ybreaks,
                default="auto")
            private$..ylab <- jmvcore::OptionString$new(
                "ylab",
                ylab,
                default="auto")
            private$..xlab <- jmvcore::OptionString$new(
                "xlab",
                xlab,
                default="auto")
            private$..axis.text.y <- jmvcore::OptionString$new(
                "axis.text.y",
                axis.text.y,
                default="14")
            private$..axis.title.y <- jmvcore::OptionString$new(
                "axis.title.y",
                axis.title.y,
                default="15")
            private$..axis.text.x <- jmvcore::OptionString$new(
                "axis.text.x",
                axis.text.x,
                default="14")
            private$..axis.title.x <- jmvcore::OptionString$new(
                "axis.title.x",
                axis.title.x,
                default="15")
            private$..simple_contrast_labels <- jmvcore::OptionBool$new(
                "simple_contrast_labels",
                simple_contrast_labels,
                default=TRUE)
            private$..error_layout <- jmvcore::OptionList$new(
                "error_layout",
                error_layout,
                default="none",
                options=list(
                    "none"))
            private$..difference_axis_breaks <- jmvcore::OptionString$new(
                "difference_axis_breaks",
                difference_axis_breaks,
                default="auto")
            private$..shape_summary_reference <- jmvcore::OptionList$new(
                "shape_summary_reference",
                shape_summary_reference,
                default="circle filled",
                options=list(
                    "circle filled",
                    "square filled",
                    "triangle filled",
                    "diamond filled"))
            private$..shape_summary_comparison <- jmvcore::OptionList$new(
                "shape_summary_comparison",
                shape_summary_comparison,
                default="circle filled",
                options=list(
                    "circle filled",
                    "square filled",
                    "triangle filled",
                    "diamond filled"))
            private$..shape_summary_difference <- jmvcore::OptionList$new(
                "shape_summary_difference",
                shape_summary_difference,
                default="triangle filled",
                options=list(
                    "circle filled",
                    "square filled",
                    "triangle filled",
                    "diamond filled"))
            private$..color_summary_reference <- jmvcore::OptionList$new(
                "color_summary_reference",
                color_summary_reference,
                default="#008DF9",
                options=list(
                    "black",
                    "#00C2F9",
                    "#008DF9",
                    "#009F81",
                    "#FF5AAF",
                    "#9F0162",
                    "#A40122",
                    "#00FCCF",
                    "#FF6E3A",
                    "#FFB2FD",
                    "#8400CD",
                    "#E20134",
                    "#FFC33B",
                    "white",
                    "NA",
                    "NA",
                    "gray0",
                    "gray5",
                    "gray10",
                    "gray15",
                    "gray20",
                    "gray25",
                    "gray30",
                    "gray35",
                    "gray40",
                    "gray45",
                    "gray50",
                    "gray55",
                    "gray60",
                    "gray65",
                    "gray70",
                    "gray75",
                    "gray80",
                    "gray85",
                    "gray90",
                    "gray95",
                    "gray100"))
            private$..color_summary_comparison <- jmvcore::OptionList$new(
                "color_summary_comparison",
                color_summary_comparison,
                default="#009F81",
                options=list(
                    "black",
                    "#00C2F9",
                    "#008DF9",
                    "#009F81",
                    "#FF5AAF",
                    "#9F0162",
                    "#A40122",
                    "#00FCCF",
                    "#FF6E3A",
                    "#FFB2FD",
                    "#8400CD",
                    "#E20134",
                    "#FFC33B",
                    "white",
                    "NA",
                    "NA",
                    "gray0",
                    "gray5",
                    "gray10",
                    "gray15",
                    "gray20",
                    "gray25",
                    "gray30",
                    "gray35",
                    "gray40",
                    "gray45",
                    "gray50",
                    "gray55",
                    "gray60",
                    "gray65",
                    "gray70",
                    "gray75",
                    "gray80",
                    "gray85",
                    "gray90",
                    "gray95",
                    "gray100"))
            private$..color_summary_difference <- jmvcore::OptionList$new(
                "color_summary_difference",
                color_summary_difference,
                default="black",
                options=list(
                    "black",
                    "#00C2F9",
                    "#008DF9",
                    "#009F81",
                    "#FF5AAF",
                    "#9F0162",
                    "#A40122",
                    "#00FCCF",
                    "#FF6E3A",
                    "#FFB2FD",
                    "#8400CD",
                    "#E20134",
                    "#FFC33B",
                    "white",
                    "NA",
                    "NA",
                    "gray0",
                    "gray5",
                    "gray10",
                    "gray15",
                    "gray20",
                    "gray25",
                    "gray30",
                    "gray35",
                    "gray40",
                    "gray45",
                    "gray50",
                    "gray55",
                    "gray60",
                    "gray65",
                    "gray70",
                    "gray75",
                    "gray80",
                    "gray85",
                    "gray90",
                    "gray95",
                    "gray100"))
            private$..fill_summary_reference <- jmvcore::OptionList$new(
                "fill_summary_reference",
                fill_summary_reference,
                default="#008DF9",
                options=list(
                    "black",
                    "#00C2F9",
                    "#008DF9",
                    "#009F81",
                    "#FF5AAF",
                    "#9F0162",
                    "#A40122",
                    "#00FCCF",
                    "#FF6E3A",
                    "#FFB2FD",
                    "#8400CD",
                    "#E20134",
                    "#FFC33B",
                    "white",
                    "NA",
                    "NA",
                    "gray0",
                    "gray5",
                    "gray10",
                    "gray15",
                    "gray20",
                    "gray25",
                    "gray30",
                    "gray35",
                    "gray40",
                    "gray45",
                    "gray50",
                    "gray55",
                    "gray60",
                    "gray65",
                    "gray70",
                    "gray75",
                    "gray80",
                    "gray85",
                    "gray90",
                    "gray95",
                    "gray100"))
            private$..fill_summary_comparison <- jmvcore::OptionList$new(
                "fill_summary_comparison",
                fill_summary_comparison,
                default="#009F81",
                options=list(
                    "black",
                    "#00C2F9",
                    "#008DF9",
                    "#009F81",
                    "#FF5AAF",
                    "#9F0162",
                    "#A40122",
                    "#00FCCF",
                    "#FF6E3A",
                    "#FFB2FD",
                    "#8400CD",
                    "#E20134",
                    "#FFC33B",
                    "white",
                    "NA",
                    "NA",
                    "gray0",
                    "gray5",
                    "gray10",
                    "gray15",
                    "gray20",
                    "gray25",
                    "gray30",
                    "gray35",
                    "gray40",
                    "gray45",
                    "gray50",
                    "gray55",
                    "gray60",
                    "gray65",
                    "gray70",
                    "gray75",
                    "gray80",
                    "gray85",
                    "gray90",
                    "gray95",
                    "gray100"))
            private$..fill_summary_difference <- jmvcore::OptionList$new(
                "fill_summary_difference",
                fill_summary_difference,
                default="black",
                options=list(
                    "black",
                    "#00C2F9",
                    "#008DF9",
                    "#009F81",
                    "#FF5AAF",
                    "#9F0162",
                    "#A40122",
                    "#00FCCF",
                    "#FF6E3A",
                    "#FFB2FD",
                    "#8400CD",
                    "#E20134",
                    "#FFC33B",
                    "white",
                    "NA",
                    "NA",
                    "gray0",
                    "gray5",
                    "gray10",
                    "gray15",
                    "gray20",
                    "gray25",
                    "gray30",
                    "gray35",
                    "gray40",
                    "gray45",
                    "gray50",
                    "gray55",
                    "gray60",
                    "gray65",
                    "gray70",
                    "gray75",
                    "gray80",
                    "gray85",
                    "gray90",
                    "gray95",
                    "gray100"))
            private$..size_summary_reference <- jmvcore::OptionList$new(
                "size_summary_reference",
                size_summary_reference,
                default="4",
                options=list(
                    "1",
                    "2",
                    "3",
                    "4",
                    "5",
                    "6"))
            private$..size_summary_comparison <- jmvcore::OptionList$new(
                "size_summary_comparison",
                size_summary_comparison,
                default="4",
                options=list(
                    "1",
                    "2",
                    "3",
                    "4",
                    "5",
                    "6"))
            private$..size_summary_difference <- jmvcore::OptionList$new(
                "size_summary_difference",
                size_summary_difference,
                default="4",
                options=list(
                    "1",
                    "2",
                    "3",
                    "4",
                    "5",
                    "6"))
            private$..alpha_summary_reference <- jmvcore::OptionList$new(
                "alpha_summary_reference",
                alpha_summary_reference,
                default="1",
                options=list(
                    "1",
                    ".75",
                    ".5",
                    ".25",
                    ".20",
                    ".15",
                    ".10",
                    ".05",
                    "0"))
            private$..alpha_summary_comparison <- jmvcore::OptionList$new(
                "alpha_summary_comparison",
                alpha_summary_comparison,
                default="1",
                options=list(
                    "1",
                    ".75",
                    ".5",
                    ".25",
                    ".20",
                    ".15",
                    ".10",
                    ".05",
                    "0"))
            private$..alpha_summary_difference <- jmvcore::OptionList$new(
                "alpha_summary_difference",
                alpha_summary_difference,
                default="1",
                options=list(
                    "1",
                    ".75",
                    ".5",
                    ".25",
                    ".20",
                    ".15",
                    ".10",
                    ".05",
                    "0"))
            private$..linetype_summary_reference <- jmvcore::OptionList$new(
                "linetype_summary_reference",
                linetype_summary_reference,
                default="solid",
                options=list(
                    "solid",
                    "dotted",
                    "dotdash",
                    "dashed",
                    "blank"))
            private$..linetype_summary_comparison <- jmvcore::OptionList$new(
                "linetype_summary_comparison",
                linetype_summary_comparison,
                default="solid",
                options=list(
                    "solid",
                    "dotted",
                    "dotdash",
                    "dashed",
                    "blank"))
            private$..linetype_summary_difference <- jmvcore::OptionList$new(
                "linetype_summary_difference",
                linetype_summary_difference,
                default="solid",
                options=list(
                    "solid",
                    "dotted",
                    "dotdash",
                    "dashed",
                    "blank"))

            self$.addOption(private$..switch)
            self$.addOption(private$..outcome_variable)
            self$.addOption(private$..grouping_variable)
            self$.addOption(private$..comparison_cases)
            self$.addOption(private$..comparison_not_cases)
            self$.addOption(private$..reference_cases)
            self$.addOption(private$..reference_not_cases)
            self$.addOption(private$..case_label)
            self$.addOption(private$..not_case_label)
            self$.addOption(private$..grouping_variable_level1)
            self$.addOption(private$..grouping_variable_level2)
            self$.addOption(private$..outcome_variable_name)
            self$.addOption(private$..grouping_variable_name)
            self$.addOption(private$..count_NA)
            self$.addOption(private$..show_ratio)
            self$.addOption(private$..show_chi_square)
            self$.addOption(private$..chi_table_option)
            self$.addOption(private$..show_phi)
            self$.addOption(private$..conf_level)
            self$.addOption(private$..show_details)
            self$.addOption(private$..evaluate_hypotheses)
            self$.addOption(private$..null_value)
            self$.addOption(private$..null_boundary)
            self$.addOption(private$..alpha)
            self$.addOption(private$..null_color)
            self$.addOption(private$..es_plot_width)
            self$.addOption(private$..es_plot_height)
            self$.addOption(private$..ymin)
            self$.addOption(private$..ymax)
            self$.addOption(private$..ybreaks)
            self$.addOption(private$..ylab)
            self$.addOption(private$..xlab)
            self$.addOption(private$..axis.text.y)
            self$.addOption(private$..axis.title.y)
            self$.addOption(private$..axis.text.x)
            self$.addOption(private$..axis.title.x)
            self$.addOption(private$..simple_contrast_labels)
            self$.addOption(private$..error_layout)
            self$.addOption(private$..difference_axis_breaks)
            self$.addOption(private$..shape_summary_reference)
            self$.addOption(private$..shape_summary_comparison)
            self$.addOption(private$..shape_summary_difference)
            self$.addOption(private$..color_summary_reference)
            self$.addOption(private$..color_summary_comparison)
            self$.addOption(private$..color_summary_difference)
            self$.addOption(private$..fill_summary_reference)
            self$.addOption(private$..fill_summary_comparison)
            self$.addOption(private$..fill_summary_difference)
            self$.addOption(private$..size_summary_reference)
            self$.addOption(private$..size_summary_comparison)
            self$.addOption(private$..size_summary_difference)
            self$.addOption(private$..alpha_summary_reference)
            self$.addOption(private$..alpha_summary_comparison)
            self$.addOption(private$..alpha_summary_difference)
            self$.addOption(private$..linetype_summary_reference)
            self$.addOption(private$..linetype_summary_comparison)
            self$.addOption(private$..linetype_summary_difference)
        }),
    active = list(
        switch = function() private$..switch$value,
        outcome_variable = function() private$..outcome_variable$value,
        grouping_variable = function() private$..grouping_variable$value,
        comparison_cases = function() private$..comparison_cases$value,
        comparison_not_cases = function() private$..comparison_not_cases$value,
        reference_cases = function() private$..reference_cases$value,
        reference_not_cases = function() private$..reference_not_cases$value,
        case_label = function() private$..case_label$value,
        not_case_label = function() private$..not_case_label$value,
        grouping_variable_level1 = function() private$..grouping_variable_level1$value,
        grouping_variable_level2 = function() private$..grouping_variable_level2$value,
        outcome_variable_name = function() private$..outcome_variable_name$value,
        grouping_variable_name = function() private$..grouping_variable_name$value,
        count_NA = function() private$..count_NA$value,
        show_ratio = function() private$..show_ratio$value,
        show_chi_square = function() private$..show_chi_square$value,
        chi_table_option = function() private$..chi_table_option$value,
        show_phi = function() private$..show_phi$value,
        conf_level = function() private$..conf_level$value,
        show_details = function() private$..show_details$value,
        evaluate_hypotheses = function() private$..evaluate_hypotheses$value,
        null_value = function() private$..null_value$value,
        null_boundary = function() private$..null_boundary$value,
        alpha = function() private$..alpha$value,
        null_color = function() private$..null_color$value,
        es_plot_width = function() private$..es_plot_width$value,
        es_plot_height = function() private$..es_plot_height$value,
        ymin = function() private$..ymin$value,
        ymax = function() private$..ymax$value,
        ybreaks = function() private$..ybreaks$value,
        ylab = function() private$..ylab$value,
        xlab = function() private$..xlab$value,
        axis.text.y = function() private$..axis.text.y$value,
        axis.title.y = function() private$..axis.title.y$value,
        axis.text.x = function() private$..axis.text.x$value,
        axis.title.x = function() private$..axis.title.x$value,
        simple_contrast_labels = function() private$..simple_contrast_labels$value,
        error_layout = function() private$..error_layout$value,
        difference_axis_breaks = function() private$..difference_axis_breaks$value,
        shape_summary_reference = function() private$..shape_summary_reference$value,
        shape_summary_comparison = function() private$..shape_summary_comparison$value,
        shape_summary_difference = function() private$..shape_summary_difference$value,
        color_summary_reference = function() private$..color_summary_reference$value,
        color_summary_comparison = function() private$..color_summary_comparison$value,
        color_summary_difference = function() private$..color_summary_difference$value,
        fill_summary_reference = function() private$..fill_summary_reference$value,
        fill_summary_comparison = function() private$..fill_summary_comparison$value,
        fill_summary_difference = function() private$..fill_summary_difference$value,
        size_summary_reference = function() private$..size_summary_reference$value,
        size_summary_comparison = function() private$..size_summary_comparison$value,
        size_summary_difference = function() private$..size_summary_difference$value,
        alpha_summary_reference = function() private$..alpha_summary_reference$value,
        alpha_summary_comparison = function() private$..alpha_summary_comparison$value,
        alpha_summary_difference = function() private$..alpha_summary_difference$value,
        linetype_summary_reference = function() private$..linetype_summary_reference$value,
        linetype_summary_comparison = function() private$..linetype_summary_comparison$value,
        linetype_summary_difference = function() private$..linetype_summary_difference$value),
    private = list(
        ..switch = NA,
        ..outcome_variable = NA,
        ..grouping_variable = NA,
        ..comparison_cases = NA,
        ..comparison_not_cases = NA,
        ..reference_cases = NA,
        ..reference_not_cases = NA,
        ..case_label = NA,
        ..not_case_label = NA,
        ..grouping_variable_level1 = NA,
        ..grouping_variable_level2 = NA,
        ..outcome_variable_name = NA,
        ..grouping_variable_name = NA,
        ..count_NA = NA,
        ..show_ratio = NA,
        ..show_chi_square = NA,
        ..chi_table_option = NA,
        ..show_phi = NA,
        ..conf_level = NA,
        ..show_details = NA,
        ..evaluate_hypotheses = NA,
        ..null_value = NA,
        ..null_boundary = NA,
        ..alpha = NA,
        ..null_color = NA,
        ..es_plot_width = NA,
        ..es_plot_height = NA,
        ..ymin = NA,
        ..ymax = NA,
        ..ybreaks = NA,
        ..ylab = NA,
        ..xlab = NA,
        ..axis.text.y = NA,
        ..axis.title.y = NA,
        ..axis.text.x = NA,
        ..axis.title.x = NA,
        ..simple_contrast_labels = NA,
        ..error_layout = NA,
        ..difference_axis_breaks = NA,
        ..shape_summary_reference = NA,
        ..shape_summary_comparison = NA,
        ..shape_summary_difference = NA,
        ..color_summary_reference = NA,
        ..color_summary_comparison = NA,
        ..color_summary_difference = NA,
        ..fill_summary_reference = NA,
        ..fill_summary_comparison = NA,
        ..fill_summary_difference = NA,
        ..size_summary_reference = NA,
        ..size_summary_comparison = NA,
        ..size_summary_difference = NA,
        ..alpha_summary_reference = NA,
        ..alpha_summary_comparison = NA,
        ..alpha_summary_difference = NA,
        ..linetype_summary_reference = NA,
        ..linetype_summary_comparison = NA,
        ..linetype_summary_difference = NA)
)

jamovipdifftwoResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
    "jamovipdifftwoResults",
    inherit = jmvcore::Group,
    active = list(
        debug = function() private$.items[["debug"]],
        help = function() private$.items[["help"]],
        overview = function() private$.items[["overview"]],
        es_proportion_difference = function() private$.items[["es_proportion_difference"]],
        contingency_table = function() private$.items[["contingency_table"]],
        es_phi = function() private$.items[["es_phi"]],
        es_odds_ratio = function() private$.items[["es_odds_ratio"]],
        point_null = function() private$.items[["point_null"]],
        interval_null = function() private$.items[["interval_null"]],
        estimation_plot_warnings = function() private$.items[["estimation_plot_warnings"]],
        estimation_plots = function() private$.items[["estimation_plots"]]),
    private = list(),
    public=list(
        initialize=function(options) {
            super$initialize(
                options=options,
                name="",
                title="Proportions: Two Groups")
            self$add(jmvcore::Preformatted$new(
                options=options,
                name="debug",
                visible=TRUE))
            self$add(jmvcore::Html$new(
                options=options,
                name="help",
                visible=FALSE))
            self$add(jmvcore::Table$new(
                options=options,
                name="overview",
                title="Overview",
                rows=1,
                clearWith=list(
                    "outcome_variable",
                    "grouping_variable",
                    "comparison_cases",
                    "comparison_not_cases",
                    "reference_cases",
                    "reference_not_cases",
                    "case_label",
                    "not_case_label",
                    "grouping_variable_level1",
                    "grouping_variable_level2",
                    "outcome_variable_name",
                    "grouping_variable_name",
                    "count_NA",
                    "conf_level",
                    "show_details"),
                columns=list(
                    list(
                        `name`="grouping_variable_name", 
                        `title`="Grouping variable", 
                        `type`="text", 
                        `combineBelow`=TRUE),
                    list(
                        `name`="grouping_variable_level", 
                        `title`="Grouping variable level", 
                        `type`="text", 
                        `combineBelow`=TRUE),
                    list(
                        `name`="outcome_variable_name", 
                        `title`="Outcome variable", 
                        `type`="text", 
                        `combineBelow`=TRUE),
                    list(
                        `name`="outcome_variable_level", 
                        `title`="Outcome variable level", 
                        `type`="text", 
                        `combineBelow`=TRUE),
                    list(
                        `name`="cases", 
                        `title`="Cases", 
                        `type`="integer"),
                    list(
                        `name`="n", 
                        `title`="<i>n</i>", 
                        `type`="integer"),
                    list(
                        `name`="P", 
                        `title`="<i>P</i>", 
                        `type`="number"),
                    list(
                        `name`="P_LL", 
                        `title`="LL", 
                        `type`="number"),
                    list(
                        `name`="P_UL", 
                        `title`="UL", 
                        `type`="number"),
                    list(
                        `name`="P_SE", 
                        `type`="number", 
                        `title`="<i>SE</i><sub>Proportion</sub>", 
                        `visible`="(show_details)"),
                    list(
                        `name`="P_adjusted", 
                        `type`="number", 
                        `title`="<i>P</i><sub>adjusted</sub>", 
                        `visible`="(show_details)"))))
            self$add(jmvcore::Table$new(
                options=options,
                name="es_proportion_difference",
                title="Proportion Difference",
                rows=3,
                refs="prop1",
                clearWith=list(
                    "outcome_variable",
                    "grouping_variable",
                    "comparison_cases",
                    "comparison_not_cases",
                    "reference_cases",
                    "reference_not_cases",
                    "case_label",
                    "not_case_label",
                    "grouping_variable_level1",
                    "grouping_variable_level2",
                    "outcome_variable_name",
                    "grouping_variable_name",
                    "count_NA",
                    "conf_level",
                    "show_details"),
                columns=list(
                    list(
                        `name`="grouping_variable_name", 
                        `title`="Grouping variable", 
                        `type`="text", 
                        `combineBelow`=TRUE, 
                        `visible`=FALSE),
                    list(
                        `name`="outcome_variable_name", 
                        `title`="Outcome variable", 
                        `type`="text", 
                        `combineBelow`=TRUE),
                    list(
                        `name`="effect", 
                        `title`="Effect", 
                        `type`="text", 
                        `visible`=FALSE),
                    list(
                        `name`="effect_plus", 
                        `title`="Effect", 
                        `type`="text"),
                    list(
                        `name`="effect_size", 
                        `type`="number", 
                        `title`="<i>P</i>"),
                    list(
                        `name`="LL", 
                        `title`="LL", 
                        `type`="number"),
                    list(
                        `name`="UL", 
                        `title`="UL", 
                        `type`="number"),
                    list(
                        `name`="SE", 
                        `title`="<i>SE</i>", 
                        `type`="number", 
                        `visible`="(show_details)"),
                    list(
                        `name`="effect_size_adjusted", 
                        `title`="<i>P</i><sub>adjusted</sub>", 
                        `type`="number", 
                        `visible`="(show_details)"))))
            self$add(jmvcore::Table$new(
                options=options,
                name="contingency_table",
                title="Chi-Square Analysis",
                rows=0,
                visible="(show_chi_square)",
                clearWith=list(
                    "outcome_variable",
                    "grouping_variable",
                    "comparison_cases",
                    "comparison_not_cases",
                    "reference_cases",
                    "reference_not_cases",
                    "case_label",
                    "not_case_label",
                    "grouping_variable_level1",
                    "grouping_variable_level2",
                    "outcome_variable_name",
                    "grouping_variable_name",
                    "count_NA",
                    "conf_level",
                    "show_details"),
                columns=list(
                    list(
                        `name`="outcome_variable_level", 
                        `title`="Outcome variable level", 
                        `type`="text"))))
            self$add(jmvcore::Table$new(
                options=options,
                name="es_phi",
                title="Correlation",
                rows=1,
                visible="(show_phi)",
                clearWith=list(
                    "outcome_variable",
                    "grouping_variable",
                    "comparison_cases",
                    "comparison_not_cases",
                    "reference_cases",
                    "reference_not_cases",
                    "case_label",
                    "not_case_label",
                    "grouping_variable_level1",
                    "grouping_variable_level2",
                    "outcome_variable_name",
                    "grouping_variable_name",
                    "count_NA",
                    "conf_level",
                    "show_details"),
                columns=list(
                    list(
                        `name`="grouping_variable_name", 
                        `title`="Grouping variable", 
                        `type`="text", 
                        `combineBelow`=TRUE, 
                        `visible`=FALSE),
                    list(
                        `name`="outcome_variable_name", 
                        `title`="Outcome variable", 
                        `type`="text", 
                        `combineBelow`=TRUE, 
                        `visible`=FALSE),
                    list(
                        `name`="effect", 
                        `title`="Effect", 
                        `type`="text"),
                    list(
                        `name`="effect_size", 
                        `type`="number", 
                        `title`="&#981;"),
                    list(
                        `name`="LL", 
                        `title`="LL", 
                        `type`="number"),
                    list(
                        `name`="UL", 
                        `title`="UL", 
                        `type`="number"),
                    list(
                        `name`="SE", 
                        `title`="<i>SE</i>", 
                        `type`="number", 
                        `visible`="(show_details)"))))
            self$add(jmvcore::Table$new(
                options=options,
                name="es_odds_ratio",
                title="Odds Ratio",
                rows=1,
                visible=TRUE,
                clearWith=list(
                    "outcome_variable",
                    "grouping_variable",
                    "comparison_cases",
                    "comparison_not_cases",
                    "reference_cases",
                    "reference_not_cases",
                    "case_label",
                    "not_case_label",
                    "grouping_variable_level1",
                    "grouping_variable_level2",
                    "outcome_variable_name",
                    "grouping_variable_name",
                    "count_NA",
                    "conf_level",
                    "show_details"),
                columns=list(
                    list(
                        `name`="grouping_variable_name", 
                        `title`="Grouping variable", 
                        `type`="text", 
                        `combineBelow`=TRUE, 
                        `visible`=FALSE),
                    list(
                        `name`="outcome_variable_name", 
                        `title`="Outcome variable", 
                        `type`="text"),
                    list(
                        `name`="effect", 
                        `title`="Effect", 
                        `type`="text", 
                        `visible`=FALSE),
                    list(
                        `name`="effect_plus", 
                        `title`="Effect", 
                        `type`="text"),
                    list(
                        `name`="effect_size", 
                        `type`="number", 
                        `title`="<i>OR</i>"),
                    list(
                        `name`="LL", 
                        `title`="LL", 
                        `type`="number"),
                    list(
                        `name`="UL", 
                        `title`="UL", 
                        `type`="number"))))
            self$add(jmvcore::Table$new(
                options=options,
                name="point_null",
                title="Hypothesis Evaluation",
                rows=1,
                visible="(evaluate_hypotheses & null_boundary == 0)",
                clearWith=list(
                    "outcome_variable",
                    "grouping_variable",
                    "comparison_cases",
                    "comparison_not_cases",
                    "reference_cases",
                    "reference_not_cases",
                    "case_label",
                    "not_case_label",
                    "grouping_variable_level1",
                    "grouping_variable_level2",
                    "outcome_variable_name",
                    "grouping_variable_name",
                    "count_NA",
                    "conf_level",
                    "show_details",
                    "null_value",
                    "null_boundary"),
                columns=list(
                    list(
                        `name`="outcome_variable_name", 
                        `title`="Outcome variable", 
                        `visible`=TRUE, 
                        `type`="text", 
                        `combineBelow`=TRUE),
                    list(
                        `name`="effect", 
                        `title`="Effect", 
                        `type`="text", 
                        `visible`=FALSE, 
                        `combineBelow`=FALSE),
                    list(
                        `name`="effect_plus", 
                        `title`="Effect", 
                        `type`="text", 
                        `combineBelow`=FALSE),
                    list(
                        `name`="null_words", 
                        `title`="<i>H</i><sub>0</sub>", 
                        `type`="text"),
                    list(
                        `name`="CI", 
                        `title`="CI", 
                        `type`="text"),
                    list(
                        `name`="CI_compare", 
                        `title`="Compare CI with <i>H</i><sub>0</sub>", 
                        `type`="text"),
                    list(
                        `name`="t", 
                        `title`="<i>z</i>", 
                        `type`="number"),
                    list(
                        `name`="p", 
                        `title`="<i>p</i>, two-tailed", 
                        `type`="number", 
                        `format`="zto,pvalue"),
                    list(
                        `name`="null_decision", 
                        `title`="<i>H</i><sub>0</sub> decision"),
                    list(
                        `name`="conclusion", 
                        `title`="Conclusion", 
                        `type`="text"))))
            self$add(jmvcore::Table$new(
                options=options,
                name="interval_null",
                title="Hypothesis Evaluation",
                rows=1,
                visible="(evaluate_hypotheses & null_boundary != 0)",
                columns=list(
                    list(
                        `name`="outcome_variable_name", 
                        `title`="Outcome variable", 
                        `visible`=TRUE, 
                        `type`="text", 
                        `combineBelow`=TRUE),
                    list(
                        `name`="effect_plus", 
                        `title`="Effect", 
                        `type`="text", 
                        `combineBelow`=FALSE),
                    list(
                        `name`="rope", 
                        `title`="<i>H</i><sub>0</sub>", 
                        `type`="text"),
                    list(
                        `name`="CI", 
                        `title`="CI", 
                        `type`="text"),
                    list(
                        `name`="rope_compare", 
                        `title`="Compare CI with <i>H</i><sub>0</sub>", 
                        `type`="text"),
                    list(
                        `name`="p_result", 
                        `title`="<i>p</i>, two tailed", 
                        `type`="text"),
                    list(
                        `name`="conclusion", 
                        `title`="Conclusion", 
                        `type`="text"))))
            self$add(jmvcore::Html$new(
                options=options,
                name="estimation_plot_warnings",
                title="Estimation Figure Warnings",
                visible=TRUE))
            self$add(jmvcore::Array$new(
                options=options,
                name="estimation_plots",
                title="Estimation Figure",
                refs="ggdist",
                template=jmvcore::Image$new(
                    options=options,
                    title="$key",
                    width=300,
                    height=450,
                    requiresData=TRUE,
                    renderFun=".estimation_plots")))}))

jamovipdifftwoBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
    "jamovipdifftwoBase",
    inherit = jmvcore::Analysis,
    public = list(
        initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
            super$initialize(
                package = "esci",
                name = "jamovipdifftwo",
                version = c(1,0,0),
                options = options,
                results = jamovipdifftwoResults$new(options=options),
                data = data,
                datasetId = datasetId,
                analysisId = analysisId,
                revision = revision,
                pause = NULL,
                completeWhenFilled = FALSE,
                requiresMissings = FALSE,
                weightsSupport = 'auto')
        }))

#' Proportions: Two Groups
#'
#' 
#' @param switch .
#' @param data .
#' @param outcome_variable .
#' @param grouping_variable .
#' @param comparison_cases .
#' @param comparison_not_cases .
#' @param reference_cases .
#' @param reference_not_cases .
#' @param case_label .
#' @param not_case_label .
#' @param grouping_variable_level1 .
#' @param grouping_variable_level2 .
#' @param outcome_variable_name .
#' @param grouping_variable_name .
#' @param count_NA .
#' @param show_ratio .
#' @param show_chi_square .
#' @param chi_table_option .
#' @param show_phi .
#' @param conf_level .
#' @param show_details .
#' @param evaluate_hypotheses .
#' @param null_value .
#' @param null_boundary .
#' @param alpha .
#' @param null_color .
#' @param es_plot_width .
#' @param es_plot_height .
#' @param ymin .
#' @param ymax .
#' @param ybreaks .
#' @param ylab .
#' @param xlab .
#' @param axis.text.y .
#' @param axis.title.y .
#' @param axis.text.x .
#' @param axis.title.x .
#' @param simple_contrast_labels .
#' @param error_layout .
#' @param difference_axis_breaks .
#' @param shape_summary_reference .
#' @param shape_summary_comparison .
#' @param shape_summary_difference .
#' @param color_summary_reference .
#' @param color_summary_comparison .
#' @param color_summary_difference .
#' @param fill_summary_reference .
#' @param fill_summary_comparison .
#' @param fill_summary_difference .
#' @param size_summary_reference .
#' @param size_summary_comparison .
#' @param size_summary_difference .
#' @param alpha_summary_reference .
#' @param alpha_summary_comparison .
#' @param alpha_summary_difference .
#' @param linetype_summary_reference .
#' @param linetype_summary_comparison .
#' @param linetype_summary_difference .
#' @return A results object containing:
#' \tabular{llllll}{
#'   \code{results$debug} \tab \tab \tab \tab \tab a preformatted \cr
#'   \code{results$help} \tab \tab \tab \tab \tab a html \cr
#'   \code{results$overview} \tab \tab \tab \tab \tab a table \cr
#'   \code{results$es_proportion_difference} \tab \tab \tab \tab \tab a table \cr
#'   \code{results$contingency_table} \tab \tab \tab \tab \tab a table \cr
#'   \code{results$es_phi} \tab \tab \tab \tab \tab a table \cr
#'   \code{results$es_odds_ratio} \tab \tab \tab \tab \tab a table \cr
#'   \code{results$point_null} \tab \tab \tab \tab \tab a table \cr
#'   \code{results$interval_null} \tab \tab \tab \tab \tab a table \cr
#'   \code{results$estimation_plot_warnings} \tab \tab \tab \tab \tab a html \cr
#'   \code{results$estimation_plots} \tab \tab \tab \tab \tab an array of images \cr
#' }
#'
#' Tables can be converted to data frames with \code{asDF} or \code{\link{as.data.frame}}. For example:
#'
#' \code{results$overview$asDF}
#'
#' \code{as.data.frame(results$overview)}
#'
#' @export
jamovipdifftwo <- function(
    switch = "from_raw",
    data,
    outcome_variable,
    grouping_variable,
    comparison_cases = " ",
    comparison_not_cases = " ",
    reference_cases = " ",
    reference_not_cases = " ",
    case_label = "Sick",
    not_case_label = "Well",
    grouping_variable_level1 = "Treated",
    grouping_variable_level2 = "Control",
    outcome_variable_name = "Outcome variable",
    grouping_variable_name = "Grouping variable",
    count_NA = FALSE,
    show_ratio = FALSE,
    show_chi_square = FALSE,
    chi_table_option = "both",
    show_phi = FALSE,
    conf_level = 95,
    show_details = FALSE,
    evaluate_hypotheses = FALSE,
    null_value = "0",
    null_boundary = "0",
    alpha = 0.05,
    null_color = "#A40122",
    es_plot_width = "400",
    es_plot_height = "450",
    ymin = "auto",
    ymax = "auto",
    ybreaks = "auto",
    ylab = "auto",
    xlab = "auto",
    axis.text.y = "14",
    axis.title.y = "15",
    axis.text.x = "14",
    axis.title.x = "15",
    simple_contrast_labels = TRUE,
    error_layout = "none",
    difference_axis_breaks = "auto",
    shape_summary_reference = "circle filled",
    shape_summary_comparison = "circle filled",
    shape_summary_difference = "triangle filled",
    color_summary_reference = "#008DF9",
    color_summary_comparison = "#009F81",
    color_summary_difference = "black",
    fill_summary_reference = "#008DF9",
    fill_summary_comparison = "#009F81",
    fill_summary_difference = "black",
    size_summary_reference = "4",
    size_summary_comparison = "4",
    size_summary_difference = "4",
    alpha_summary_reference = "1",
    alpha_summary_comparison = "1",
    alpha_summary_difference = "1",
    linetype_summary_reference = "solid",
    linetype_summary_comparison = "solid",
    linetype_summary_difference = "solid") {

    if ( ! requireNamespace("jmvcore", quietly=TRUE))
        stop("jamovipdifftwo requires jmvcore to be installed (restart may be required)")

    if ( ! missing(outcome_variable)) outcome_variable <- jmvcore::resolveQuo(jmvcore::enquo(outcome_variable))
    if ( ! missing(grouping_variable)) grouping_variable <- jmvcore::resolveQuo(jmvcore::enquo(grouping_variable))
    if (missing(data))
        data <- jmvcore::marshalData(
            parent.frame(),
            `if`( ! missing(outcome_variable), outcome_variable, NULL),
            `if`( ! missing(grouping_variable), grouping_variable, NULL))

    for (v in outcome_variable) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
    for (v in grouping_variable) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])

    options <- jamovipdifftwoOptions$new(
        switch = switch,
        outcome_variable = outcome_variable,
        grouping_variable = grouping_variable,
        comparison_cases = comparison_cases,
        comparison_not_cases = comparison_not_cases,
        reference_cases = reference_cases,
        reference_not_cases = reference_not_cases,
        case_label = case_label,
        not_case_label = not_case_label,
        grouping_variable_level1 = grouping_variable_level1,
        grouping_variable_level2 = grouping_variable_level2,
        outcome_variable_name = outcome_variable_name,
        grouping_variable_name = grouping_variable_name,
        count_NA = count_NA,
        show_ratio = show_ratio,
        show_chi_square = show_chi_square,
        chi_table_option = chi_table_option,
        show_phi = show_phi,
        conf_level = conf_level,
        show_details = show_details,
        evaluate_hypotheses = evaluate_hypotheses,
        null_value = null_value,
        null_boundary = null_boundary,
        alpha = alpha,
        null_color = null_color,
        es_plot_width = es_plot_width,
        es_plot_height = es_plot_height,
        ymin = ymin,
        ymax = ymax,
        ybreaks = ybreaks,
        ylab = ylab,
        xlab = xlab,
        axis.text.y = axis.text.y,
        axis.title.y = axis.title.y,
        axis.text.x = axis.text.x,
        axis.title.x = axis.title.x,
        simple_contrast_labels = simple_contrast_labels,
        error_layout = error_layout,
        difference_axis_breaks = difference_axis_breaks,
        shape_summary_reference = shape_summary_reference,
        shape_summary_comparison = shape_summary_comparison,
        shape_summary_difference = shape_summary_difference,
        color_summary_reference = color_summary_reference,
        color_summary_comparison = color_summary_comparison,
        color_summary_difference = color_summary_difference,
        fill_summary_reference = fill_summary_reference,
        fill_summary_comparison = fill_summary_comparison,
        fill_summary_difference = fill_summary_difference,
        size_summary_reference = size_summary_reference,
        size_summary_comparison = size_summary_comparison,
        size_summary_difference = size_summary_difference,
        alpha_summary_reference = alpha_summary_reference,
        alpha_summary_comparison = alpha_summary_comparison,
        alpha_summary_difference = alpha_summary_difference,
        linetype_summary_reference = linetype_summary_reference,
        linetype_summary_comparison = linetype_summary_comparison,
        linetype_summary_difference = linetype_summary_difference)

    analysis <- jamovipdifftwoClass$new(
        options = options,
        data = data)

    analysis$run()

    analysis$results
}
rcalinjageman/esci documentation built on March 29, 2024, 7:30 p.m.