Skip to content

Commit

Permalink
Merge pull request #43 from rcalinjageman/development
Browse files Browse the repository at this point in the history
markdown for plot axis titles, updated DR CI note, better handling of…
  • Loading branch information
rcalinjageman authored Mar 11, 2024
2 parents 5352793 + 6fdae90 commit 9f1119d
Show file tree
Hide file tree
Showing 47 changed files with 296 additions and 53 deletions.
76 changes: 76 additions & 0 deletions R/00jmv.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

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

.jmvrefs <- list(
`lc_median_bs`=list(
`type`="article",
`author`="Bonett, D.G. & Price, R. M.",
`year`=2002,
`title`="Statistical inference for a linear function of medians: Confidence intervals, hypothesis testing, and sample size requirements",
`publisher`="Psychological Methods",
`volume`=7,
`pages`="370-383",
`url`="https://psycnet.apa.org/doiLanding?doi=10.1037%2F1082-989X.7.3.370"),
`lc_stdmean_bs`=list(
`type`="article",
`author`="Bonett, D.G.",
`year`=2008,
`title`="Confidence intervals for standardized linear contrasts of means",
`publisher`="Psychological Methods",
`volume`=13,
`pages`="99-109",
`url`="https://psycnet.apa.org/doiLanding?doi=10.1037%2F1082-989X.13.2.99"),
`median_ps`=list(
`type`="article",
`author`="Bonett, D.G. & Price, R. M.",
`year`=2020,
`title`="Interval estimation for linear functions of medians in within-subjects and mixed designs",
`publisher`="British Journal of Mathematical and Statistical Psychology",
`volume`=73,
`pages`="333-346",
`url`="https://bpspsychub.onlinelibrary.wiley.com/doi/10.1111/bmsp.12171"),
`ratio_ps`=list(
`type`="article",
`author`="Bonett, D.G. & Price, R. M.",
`year`=2020,
`title`="Confidence intervals for ratios of means and medians",
`publisher`="Journal of Educational and Behavioral Statistics",
`volume`=45,
`pages`="750-770",
`url`="https://journals.sagepub.com/doi/10.3102/1076998620934125"),
`metafor`=list(
`type`="article",
`author`="Viechtbauer, W.",
`year`=2010,
`title`="Conducting Meta-Analyses in R with the metafor Package",
`publisher`="Journal of Statistical Software",
`volume`=36,
`pages`="1-48",
`url`="https://doi.org/10.18637/jss.v036.i03"),
`ggdist`=list(
`type`="article",
`author`="Kay, M.",
`year`=2002,
`title`="ggdist: Visualizations of Distributions and Uncertainty in the Grammar of Graphics",
`publisher`="IEEE Transactions on Visualization and Computer Graphics",
`volume`=30,
`pages`="414-424",
`url`="https://zenodo.org/records/7933524"),
`prop1`=list(
`type`="article",
`author`="Agresti, A. & Coull, B. A.",
`year`=1998,
`title`="Approximate is better than exact for interval estimation of binomial proportions",
`publisher`="The American Statistician",
`volume`=52,
`pages`="119-126",
`url`="https://www.tandfonline.com/doi/abs/10.1080/00031305.1998.10480550"),
`prop_paired`=list(
`type`="article",
`author`="Bonett, D.G. & Price, R. M.",
`year`=2012,
`title`="Adjusted wald confidence interval for a difference of binomial proportions based on paired data",
`publisher`="Journal of Educational and Behavioral Statistics",
`volume`=37,
`pages`="479-488",
`url`="https://journals.sagepub.com/doi/10.3102/1076998611411915"))
7 changes: 3 additions & 4 deletions R/estimate_mdiff_ind_contrast.R
Original file line number Diff line number Diff line change
Expand Up @@ -889,17 +889,16 @@ Invalid groups are those with n < 2.

estimate$es_mean_ratio_properties <- list(
message_html = paste(
if (no_negs) "" else "WARNING! Your data has negative values. ",
"This effect-size measure is appropriate only for true ratio scales where values < 0 are impossible.
For more information on this effect size, see Bonett & Price (2020) doi: 10.3102/1076998620934125.",
if (no_negs) "" else "WARNING! Your dataset includes negative values. ",
"This effect-size measure is appropriate only for true ratio scales.",
sep = ""
)
)

if (!no_negs) {
estimate$warnings <- c(
estimate$warnings,
"neg_values" = "The ratio between group effect size is appropriate only for true ratio scales where values < 0 are impossible. Your data has negative values and therefore any ratio between groups is invalid and should not be interpreted."
"neg_values" = "The ratio between group effect size is appropriate only for true ratio scales where values < 0 are impossible. Your data include at least one negative value, so the requested ratio effect size is not reported."
)
}

Expand Down
7 changes: 3 additions & 4 deletions R/estimate_mdiff_paired.R
Original file line number Diff line number Diff line change
Expand Up @@ -639,17 +639,16 @@ estimate_mdiff_paired.data.frame <- function(

estimate$es_mean_ratio_properties <- list(
message_html = paste(
if (no_negs) "" else "WARNING! Your data has negative values. ",
"This effect-size measure is appropriate only for true ratio scales where values < 0 are impossible.
For more information on this effect size, see Bonett & Price (2020) doi: 10.3102/1076998620934125.",
if (no_negs) "" else "WARNING! Your dataset includes negative values. ",
"This effect-size measure is appropriate only for true ratio scales.",
sep = ""
)
)

if (!no_negs) {
estimate$warnings <- c(
estimate$warnings,
"neg_values" = "The ratio between measures effect size is appropriate only for true ratio scales where values < 0 are impossible. Your data has negative values and therefore the any ratio between measures is invalid and should not be interpreted."
"neg_values" = "The ratio between group effect size is appropriate only for true ratio scales where values < 0 are impossible. Your data include at least one negative value, so the requested ratio effect size is not reported."
)
}

Expand Down
8 changes: 4 additions & 4 deletions R/estimate_mdiff_two.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@
#' )
#'
#' \dontrun{
#' # To visualize the estimated median difference (raw data only)
#' plot_mdiff(estimate, effect_size = "median")
#' # To visualize the estimated mean difference
#' plot_mdiff(estimate, effect_size = "mean")
#' }

#'
Expand All @@ -164,8 +164,8 @@
#' )
#'
#' \dontrun{
#' # To visualize the estimated mean difference
#' plot_mdiff(estimate, effect_size = "mean")
#' # To visualize the estimated median difference (raw data only)
#' plot_mdiff(estimate, effect_size = "median")
#' }
#'
#'
Expand Down
8 changes: 4 additions & 4 deletions R/jamovidescribe.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,10 @@ jamovidescribeClass <- if (requireNamespace('jmvcore', quietly=TRUE)) R6::R6Clas


myplot <- myplot + ggplot2::theme(
axis.text.y = element_text(size = axis.text.y),
axis.title.y = element_text(size = axis.title.y),
axis.text.x = element_text(size = axis.text.x),
axis.title.x = element_text(size = axis.title.x)
axis.text.y = ggtext::element_markdown(size = axis.text.y),
axis.title.y = ggtext::element_markdown(size = axis.title.y),
axis.text.x = ggtext::element_markdown(size = axis.text.x),
axis.title.x = ggtext::element_markdown(size = axis.title.x)
)


Expand Down
8 changes: 4 additions & 4 deletions R/jamovimagnitude.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ jamovimagnitudeClass <- if (requireNamespace('jmvcore', quietly=TRUE)) R6::R6Cla


myplot <- myplot + ggplot2::theme(
axis.text.y = element_text(size = axis.text.y),
axis.title.y = element_text(size = axis.title.y),
axis.text.x = element_text(size = axis.text.x),
axis.title.x = element_text(size = axis.title.x)
axis.text.y = ggtext::element_markdown(size = axis.text.y),
axis.title.y = ggtext::element_markdown(size = axis.title.y),
axis.text.x = ggtext::element_markdown(size = axis.text.x),
axis.title.x = ggtext::element_markdown(size = axis.title.x)
)


Expand Down
3 changes: 2 additions & 1 deletion R/jamovimagnitude.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,8 @@ jamovimagnitudeResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6C
requiresData=TRUE,
width=400,
height=300,
renderFun=".magnitude_plot"))}))
renderFun=".magnitude_plot",
refs="ggdist"))}))

jamovimagnitudeBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"jamovimagnitudeBase",
Expand Down
3 changes: 3 additions & 0 deletions R/jamovimdiff2x2.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -2389,6 +2389,7 @@ jamovimdiff2x2Results <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cl
name="es_median_difference",
title="Median Difference",
visible="(effect_size == 'median_difference' & design == 'fully_between')",
refs="lc_median_bs",
rows="15 - switch - outcome_variable - grouping_variable_A - grouping_variable_B - outcome_variable_level1 - outcome_variable_level2 - outcome_variable_name_bs - grouping_variable - repeated_measures_name - outcome_variable_name - conf_level - effect_size - assume_equal_variance - show_details",
columns=list(
list(
Expand Down Expand Up @@ -2540,6 +2541,7 @@ jamovimdiff2x2Results <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cl
name="es_smd",
title="Standardized Mean Difference",
rows=5,
refs="lc_stdmean_bs",
visible="(effect_size == 'mean_difference' & design == 'fully_between')",
clearWith=list(
"switch",
Expand Down Expand Up @@ -2810,6 +2812,7 @@ jamovimdiff2x2Results <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cl
requiresData=TRUE,
width=700,
height=400,
refs="ggdist",
renderFun=".estimation_plot"))
self$add(jmvcore::Image$new(
options=options,
Expand Down
3 changes: 3 additions & 0 deletions R/jamovimdiffindcontrast.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -2191,6 +2191,7 @@ jamovimdiffindcontrastResults <- if (requireNamespace("jmvcore", quietly=TRUE))
"effect_size",
"assume_equal_variance",
"show_details"),
refs="lc_median_bs",
columns=list(
list(
`name`="outcome_variable_name",
Expand Down Expand Up @@ -2300,6 +2301,7 @@ jamovimdiffindcontrastResults <- if (requireNamespace("jmvcore", quietly=TRUE))
title="Standardized Mean Difference",
rows=1,
visible="(effect_size == 'mean_difference')",
refs="lc_stdmean_bs",
clearWith=list(
"switch",
"outcome_variable",
Expand Down Expand Up @@ -2521,6 +2523,7 @@ jamovimdiffindcontrastResults <- if (requireNamespace("jmvcore", quietly=TRUE))
options=options,
name="estimation_plots",
title="Estimation Figure",
refs="ggdist",
template=jmvcore::Image$new(
options=options,
title="$key",
Expand Down
4 changes: 4 additions & 0 deletions R/jamovimdiffpaired.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ jamovi_mdiff_paired <- function(self, save_raw_data = FALSE) {
if (!is.na(estimate$warnings["neg_values"])) {
estimate$warnings <- estimate$warnings[names(estimate$warnings) != "neg_values"]
}
} else {
to_show <- is.na(estimate$warnings["neg_values"])
self$results$es_mean_ratio$setVisible(to_show & self$options$effect_size == "mean_difference")
self$results$es_median_ratio$setVisible(to_show & self$options$effect_size == "median_difference")
}

notes <- c(notes, estimate$warnings)
Expand Down
5 changes: 5 additions & 0 deletions R/jamovimdiffpaired.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -2037,6 +2037,7 @@ jamovimdiffpairedResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R
name="es_smd",
title="Standardized Mean Difference",
rows=1,
refs="lc_stdmean_bs",
visible="(effect_size == 'mean_difference')",
clearWith=list(
"switch",
Expand Down Expand Up @@ -2115,6 +2116,7 @@ jamovimdiffpairedResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R
title="Ratio of Means",
visible="(show_ratio & effect_size == 'mean_difference')",
rows=1,
refs="ratio_ps",
clearWith=list(
"switch",
"reference_measure",
Expand Down Expand Up @@ -2175,6 +2177,7 @@ jamovimdiffpairedResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R
name="es_median_difference",
title="Median Difference",
visible="(effect_size == 'median_difference')",
refs="median_ps",
rows=3,
clearWith=list(
"switch",
Expand Down Expand Up @@ -2234,6 +2237,7 @@ jamovimdiffpairedResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R
title="Ratio of Medians",
visible="(show_ratio & effect_size == 'median_difference')",
rows=1,
refs="ratio_ps",
clearWith=list(
"switch",
"reference_measure",
Expand Down Expand Up @@ -2439,6 +2443,7 @@ jamovimdiffpairedResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R
width=300,
height=450,
requiresData=TRUE,
refs="ggdist",
renderFun=".estimation_plots"))}))

jamovimdiffpairedBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
Expand Down
4 changes: 4 additions & 0 deletions R/jamovimdifftwo.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ jamovi_mdiff_two <- function(
if (!is.na(estimate$warnings["neg_values"])) {
estimate$warnings <- estimate$warnings[names(estimate$warnings) != "neg_values"]
}
} else {
to_show <- is.na(estimate$warnings["neg_values"])
self$results$es_mean_ratio$setVisible(to_show & self$options$effect_size == "mean_difference")
self$results$es_median_ratio$setVisible(to_show & self$options$effect_size == "median_difference")
}

notes <- c(notes, estimate$warnings)
Expand Down
5 changes: 5 additions & 0 deletions R/jamovimdifftwo.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,7 @@ jamovimdifftwoResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cl
name="es_smd",
title="Standardized Mean Difference",
rows=1,
refs="lc_stdmean_bs",
visible="(effect_size == 'mean_difference')",
clearWith=list(
"switch",
Expand Down Expand Up @@ -1953,6 +1954,7 @@ jamovimdifftwoResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cl
title="Ratio of Means",
visible="(show_ratio & effect_size == 'mean_difference')",
rows="(outcome_variable)",
refs="ratio_ps",
clearWith=list(
"switch",
"outcome_variable",
Expand Down Expand Up @@ -2015,6 +2017,7 @@ jamovimdifftwoResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cl
title="Median Difference",
visible="(effect_size == 'median_difference')",
rows=3,
refs="lc_median_bs",
clearWith=list(
"switch",
"outcome_variable",
Expand Down Expand Up @@ -2074,6 +2077,7 @@ jamovimdifftwoResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cl
title="Ratio of Medians",
visible="(show_ratio & effect_size == 'median_difference')",
rows="(outcome_variable)",
refs="ratio_ps",
clearWith=list(
"switch",
"outcome_variable",
Expand Down Expand Up @@ -2286,6 +2290,7 @@ jamovimdifftwoResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cl
options=options,
name="estimation_plots",
title="Estimation Figure",
refs="ggdist",
template=jmvcore::Image$new(
options=options,
title="$key",
Expand Down
1 change: 1 addition & 0 deletions R/jamovimetamdiff.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -1909,6 +1909,7 @@ jamovimetamdiffResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6C
name="es_meta",
title="Meta-Analytic Effect Sizes",
rows=1,
refs="metafor",
clearWith=list(
"switch",
"comparison_means",
Expand Down
1 change: 1 addition & 0 deletions R/jamovimetamean.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -1806,6 +1806,7 @@ jamovimetameanResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Cl
name="es_meta",
title="Meta-Analytic Effect Sizes",
rows=1,
refs="metafor",
clearWith=list(
"means",
"sds",
Expand Down
1 change: 1 addition & 0 deletions R/jamovimetapdiff.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,7 @@ jamovimetapdiffResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6C
options=options,
name="es_meta",
title="Meta-Analytic Effect Sizes",
refs="metafor",
rows=1,
clearWith=list(
"reference_cases",
Expand Down
1 change: 1 addition & 0 deletions R/jamovimetaproportion.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,7 @@ jamovimetaproportionResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6
name="es_meta",
title="Meta-Analytic Effect Sizes",
rows=1,
refs="metafor",
clearWith=list(
"cases",
"ns",
Expand Down
1 change: 1 addition & 0 deletions R/jamovimetar.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,7 @@ jamovimetarResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class
name="es_meta",
title="Meta-Analytic Effect Sizes",
rows=1,
refs="metafor",
clearWith=list(
"rs",
"ns",
Expand Down
2 changes: 2 additions & 0 deletions R/jamovipdiffpaired.h.R
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,7 @@ jamovipdiffpairedResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R
name="es_proportion_difference",
title="Proportion Difference",
rows=3,
refs="prop_paired",
clearWith=list(
"reference_measure",
"comparison_measure",
Expand Down Expand Up @@ -1027,6 +1028,7 @@ jamovipdiffpairedResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R
width=300,
height=450,
requiresData=TRUE,
refs="ggdist",
renderFun=".estimation_plots"))}))

jamovipdiffpairedBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
Expand Down
Loading

0 comments on commit 9f1119d

Please sign in to comment.