diff --git a/DESCRIPTION b/DESCRIPTION index 14c33fbce..2bd2da770 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,7 +25,7 @@ Authors@R: role = c("ctb"), comment = c(ORCID = "0000-0002-3948-3914")) ) -Description: Compute and plot predictions, slopes, marginal means, and comparisons (contrasts, risk ratios, odds, etc.) for over 100 classes of statistical and machine learning models in R. Conduct linear and non-linear hypothesis tests, or equivalence tests. Calculate uncertainty estimates using the delta method, bootstrapping, or simulation-based inference. +Description: Compute and plot predictions, slopes, marginal means, and comparisons (contrasts, risk ratios, odds, etc.) for over 100 classes of statistical and machine learning models in R. Conduct linear and non-linear hypothesis tests, or equivalence tests. Calculate uncertainty estimates using the delta method, bootstrapping, or simulation-based inference. Details can be found in Arel-Bundock, Greifer, and Heiss (2024) . License: GPL (>= 3) Copyright: inst/COPYRIGHTS LazyData: true diff --git a/R/comparisons.R b/R/comparisons.R index 166da99a0..7b625d877 100644 --- a/R/comparisons.R +++ b/R/comparisons.R @@ -85,6 +85,7 @@ #' @param cross #' * `FALSE`: Contrasts represent the change in adjusted predictions when one predictor changes and all other variables are held constant. #' * `TRUE`: Contrasts represent the changes in adjusted predictions when all the predictors specified in the `variables` argument are manipulated simultaneously (a "cross-contrast"). +#' @template references #' @template deltamethod #' @template model_specific_arguments #' @template comparison_functions @@ -93,7 +94,6 @@ #' @template type #' @template order_of_operations #' @template parallel -#' @template references #' @template options #' #' @return A `data.frame` with one row per observation (per term/group) and several columns: diff --git a/R/package.R b/R/package.R index ca365796c..2422ff485 100644 --- a/R/package.R +++ b/R/package.R @@ -5,76 +5,77 @@ #' @useDynLib marginaleffects #' @import data.table utils::globalVariables(c( -"marginaleffects_contrast_hi", -"marginaleffects_contrast_lo", -"..bycols", -"..to_keep", -"..cols", -"..idx_by", -"..idx_hi", -"..cl", -"..idx_lo", -".data", -"..idx_or", -"..idx", -"..idx1", -"..idx2", -"..nonfocal", -"rowidcf", -"elast", -"..tmp", -"..variables_grid", -"..w", -"marginaleffects_lab", -"marginaleffects_ter", -"..label_columns", -"marginaleffects_internal_label", -".", -"tmp_idx", -"chunk", -"comparison", -"condition_variable", -"conf_int", -"conf_level", -"conf.high", -"conf.low", -"contrast", -"draw", -"dydx", -"eps", -"estimates", -"estimate", -"formatBicLL", -"gn", -"group", -"logLik", -"m", -"marginaleffects_function", -"marginaleffects_wts_internal", -"marginalmean", -"model", -"N", -"p.value", -"part", -"patterns", -"position", -"predicted_hi", -"predicted_lo", -"predicted_or", -"predicted", -"rowid", -"rowidunique", -"hi", -"lo", -"section", -"stars_note", -"statistic", -"statistic1", -"std.error", -"term", -"ticks", -"tmp_grp", -"comparison_idx", -"value", -"where", -"wts")) + "marginaleffects_contrast_hi", + "marginaleffects_contrast_lo", + "..bycols", + "..to_keep", + "..cols", + "..idx_by", + "..idx_hi", + "..cl", + "..idx_lo", + ".data", + "..idx_or", + "..idx", + "..idx1", + "..idx2", + "..nonfocal", + "aa", + "rowidcf", + "elast", + "..tmp", + "..variables_grid", + "..w", + "marginaleffects_lab", + "marginaleffects_ter", + "..label_columns", + "marginaleffects_internal_label", + ".", + "tmp_idx", + "chunk", + "comparison", + "condition_variable", + "conf_int", + "conf_level", + "conf.high", + "conf.low", + "contrast", + "draw", + "dydx", + "eps", + "estimates", + "estimate", + "formatBicLL", + "gn", + "group", + "logLik", + "m", + "marginaleffects_function", + "marginaleffects_wts_internal", + "marginalmean", + "model", + "N", + "p.value", + "part", + "patterns", + "position", + "predicted_hi", + "predicted_lo", + "predicted_or", + "predicted", + "rowid", + "rowidunique", + "hi", + "lo", + "section", + "stars_note", + "statistic", + "statistic1", + "std.error", + "term", + "ticks", + "tmp_grp", + "comparison_idx", + "value", + "where", + "wts")) diff --git a/R/predictions.R b/R/predictions.R index 5ae94a7fd..7cddb4539 100644 --- a/R/predictions.R +++ b/R/predictions.R @@ -61,6 +61,7 @@ #' first entry in the error message is used by default. #' @param transform A function applied to unit-level adjusted predictions and confidence intervals just before the function returns results. For bayesian models, this function is applied to individual draws from the posterior distribution, before computing summaries. #' +#' @template references #' @template deltamethod #' @template model_specific_arguments #' @template bayesian @@ -68,7 +69,6 @@ #' @template type #' @template order_of_operations #' @template parallel -#' @template references #' @template options #' #' @return A `data.frame` with one row per observation and several columns: diff --git a/R/slopes.R b/R/slopes.R index d775f8458..f0f326273 100644 --- a/R/slopes.R +++ b/R/slopes.R @@ -127,13 +127,13 @@ #' using a simple epsilon difference approach: \eqn{\partial Y / \partial X = (f(X + \varepsilon/2) - f(X-\varepsilon/2)) / \varepsilon}{dY/dX = (f(X + e/2) - f(X-e/2)) / e}, #' where f is the `predict()` method associated with the model class, and #' \eqn{\varepsilon}{e} is determined by the `eps` argument. +#' @template references #' @template deltamethod #' @template model_specific_arguments #' @template bayesian #' @template equivalence #' @template type #' @template parallel -#' @template references #' @template order_of_operations #' @template options #' diff --git a/inst/CITATION b/inst/CITATION index acccbdbc2..8783fc5c2 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -1,25 +1,20 @@ bibentry(bibtype = "Article", - key = "R-marginaleffects", - title = "How to Interpret Statistical Models Using \\texttt{marginaleffects} in \\texttt{R} and \\texttt{Python}", - author = c( - person(given = "Vincent", - family = "Arel-Bundock", - email = "vincent.arel-bundock@umontreal.ca"), - person(given = "Noah", - family = "Greifer", - email = "ngreifer@iq.harvard.edu"), - person(given = "Andrew", - family = "Heiss", - email = "aheiss@gsu.edu") - ), - year = "Forthcoming", + title = "How to Interpret Statistical Models Using {marginaleffects} for {R} and {Python}", + author = c(person(given = "Vincent", + family = "Arel-Bundock", + email = "vincent.arel-bundock@umontreal.ca"), + person(given = "Noah", + family = "Greifer", + email = "ngreifer@iq.harvard.edu"), + person(given = "Andrew", + family = "Heiss", + email = "aheiss@gsu.edu")), journal = "Journal of Statistical Software", - url = "https://marginaleffects.com", - header = "To cite marginaleffects in publications, please use:", - textVersion = - paste("Vincent Arel-Bundock, Noah Greifer, and Andrew Heiss.", - "Forthcoming.", - "How to Interpret Statistical Models Using marginaleffects in R and Python.", - "Journal of Statistical Software.", - "https://marginaleffects.com") + year = "2024", + volume = "111", + number = "9", + pages = "1--32", + doi = "10.18637/jss.v111.i09", + header = "To cite marginaleffects in publications use:" ) + diff --git a/inst/tinytest/helpers.R b/inst/tinytest/helpers.R index dbc9c6a8f..2142e073c 100644 --- a/inst/tinytest/helpers.R +++ b/inst/tinytest/helpers.R @@ -1,7 +1,7 @@ rm(list = ls()) rm(list = ls(.GlobalEnv), envir = .GlobalEnv) -EXPENSIVE <- FALSE +EXPENSIVE <- TRUE options("tinysnapshot_device" = "svglite") options("tinysnapshot_tol" = 200) diff --git a/man-roxygen/references.R b/man-roxygen/references.R index 07dad5647..9c37459bc 100644 --- a/man-roxygen/references.R +++ b/man-roxygen/references.R @@ -1,4 +1,5 @@ #' @references -#' +#' +#' * Arel-Bundock V, Greifer N, Heiss A (2024). “How to Interpret Statistical Models Using marginaleffects for R and Python.” _Journal of Statistical Software_, *111*(9), 1-32. doi:10.18637/jss.v111.i09 . #' * Greenland S. 2019. "Valid P-Values Behave Exactly as They Should: Some Misleading Criticisms of P-Values and Their Resolution With S-Values." The American Statistician. 73(S1): 106–114. #' * Cole, Stephen R, Jessie K Edwards, and Sander Greenland. 2020. "Surprise!" American Journal of Epidemiology 190 (2): 191–93. https://doi.org/10.1093/aje/kwaa136 diff --git a/man/comparisons.Rd b/man/comparisons.Rd index ecd258de8..97ef0ca13 100644 --- a/man/comparisons.Rd +++ b/man/comparisons.Rd @@ -650,6 +650,7 @@ comparisons(mod, type = "probs", by = by) } \references{ \itemize{ +\item Arel-Bundock V, Greifer N, Heiss A (2024). “How to Interpret Statistical Models Using marginaleffects for R and Python.” \emph{Journal of Statistical Software}, \emph{111}(9), 1-32. doi:10.18637/jss.v111.i09 \url{https://doi.org/10.18637/jss.v111.i09}. \item Greenland S. 2019. "Valid P-Values Behave Exactly as They Should: Some Misleading Criticisms of P-Values and Their Resolution With S-Values." The American Statistician. 73(S1): 106–114. \item Cole, Stephen R, Jessie K Edwards, and Sander Greenland. 2020. "Surprise!" American Journal of Epidemiology 190 (2): 191–93. https://doi.org/10.1093/aje/kwaa136 } diff --git a/man/predictions.Rd b/man/predictions.Rd index 6c451e4d9..294e1afd6 100644 --- a/man/predictions.Rd +++ b/man/predictions.Rd @@ -549,6 +549,7 @@ predictions(mod, newdata = "mean", byfun = sum, by = by) } \references{ \itemize{ +\item Arel-Bundock V, Greifer N, Heiss A (2024). “How to Interpret Statistical Models Using marginaleffects for R and Python.” \emph{Journal of Statistical Software}, \emph{111}(9), 1-32. doi:10.18637/jss.v111.i09 \url{https://doi.org/10.18637/jss.v111.i09}. \item Greenland S. 2019. "Valid P-Values Behave Exactly as They Should: Some Misleading Criticisms of P-Values and Their Resolution With S-Values." The American Statistician. 73(S1): 106–114. \item Cole, Stephen R, Jessie K Edwards, and Sander Greenland. 2020. "Surprise!" American Journal of Epidemiology 190 (2): 191–93. https://doi.org/10.1093/aje/kwaa136 } diff --git a/man/slopes.Rd b/man/slopes.Rd index c18fdb5ae..3f41444dd 100644 --- a/man/slopes.Rd +++ b/man/slopes.Rd @@ -520,6 +520,7 @@ slopes( } \references{ \itemize{ +\item Arel-Bundock V, Greifer N, Heiss A (2024). “How to Interpret Statistical Models Using marginaleffects for R and Python.” \emph{Journal of Statistical Software}, \emph{111}(9), 1-32. doi:10.18637/jss.v111.i09 \url{https://doi.org/10.18637/jss.v111.i09}. \item Greenland S. 2019. "Valid P-Values Behave Exactly as They Should: Some Misleading Criticisms of P-Values and Their Resolution With S-Values." The American Statistician. 73(S1): 106–114. \item Cole, Stephen R, Jessie K Edwards, and Sander Greenland. 2020. "Surprise!" American Journal of Epidemiology 190 (2): 191–93. https://doi.org/10.1093/aje/kwaa136 }