# This file is automatically generated, you probably don't want to edit this
metaDVOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
"metaDVOptions",
inherit = jmvcore::Options,
public = list(
initialize = function(
effectSize = NULL,
samplingVariances = NULL,
slab = NULL,
moderatorcor = NULL,
methodmetacor = "REML",
moderatorType = "NON",
level = 95,
showModelFit = FALSE,
addcred = FALSE,
addfit = TRUE,
showweights = FALSE,
steps = 5,
xAxisTitle = NULL,
pchForest = "15",
forestOrder = "fit",
fsntype = "Rosenthal",
yaxis = "sei",
yaxisInv = FALSE,
enhanceFunnel = FALSE,
lowerTOST = -0.5,
upperTOST = 0.5,
alphaTOST = 0.05,
showTestTOST = TRUE,
showInfPlot = FALSE, ...) {
super$initialize(
package='MAJOR',
name='metaDV',
requiresData=TRUE,
...)
private$..effectSize <- jmvcore::OptionVariable$new(
"effectSize",
effectSize,
suggested=list(
"continuous"),
permitted=list(
"numeric"))
private$..samplingVariances <- jmvcore::OptionVariable$new(
"samplingVariances",
samplingVariances,
suggested=list(
"continuous"),
permitted=list(
"numeric"))
private$..slab <- jmvcore::OptionVariable$new(
"slab",
slab,
suggested=list(
"nominal"))
private$..moderatorcor <- jmvcore::OptionVariable$new(
"moderatorcor",
moderatorcor,
suggested=list(
"continuous"),
permitted=list(
"numeric"))
private$..methodmetacor <- jmvcore::OptionList$new(
"methodmetacor",
methodmetacor,
options=list(
"DL",
"HE",
"HS",
"SJ",
"ML",
"REML",
"EB",
"PM",
"FE"),
default="REML")
private$..moderatorType <- jmvcore::OptionList$new(
"moderatorType",
moderatorType,
options=list(
"NON",
"CAT",
"CON"),
default="NON")
private$..level <- jmvcore::OptionNumber$new(
"level",
level,
min=50,
max=99.9,
default=95)
private$..showModelFit <- jmvcore::OptionBool$new(
"showModelFit",
showModelFit,
default=FALSE)
private$..addcred <- jmvcore::OptionBool$new(
"addcred",
addcred,
default=FALSE)
private$..addfit <- jmvcore::OptionBool$new(
"addfit",
addfit,
default=TRUE)
private$..showweights <- jmvcore::OptionBool$new(
"showweights",
showweights,
default=FALSE)
private$..steps <- jmvcore::OptionNumber$new(
"steps",
steps,
min=1,
max=999,
default=5)
private$..xAxisTitle <- jmvcore::OptionString$new(
"xAxisTitle",
xAxisTitle)
private$..pchForest <- jmvcore::OptionList$new(
"pchForest",
pchForest,
options=list(
"16",
"18",
"15",
"17",
"1",
"5",
"0",
"2",
"8"),
default="15")
private$..forestOrder <- jmvcore::OptionList$new(
"forestOrder",
forestOrder,
options=list(
"obs",
"fit",
"prec",
"resid",
"abs.resid"),
default="fit")
private$..fsntype <- jmvcore::OptionList$new(
"fsntype",
fsntype,
options=list(
"Rosenthal",
"Orwin",
"Rosenberg"),
default="Rosenthal")
private$..yaxis <- jmvcore::OptionList$new(
"yaxis",
yaxis,
options=list(
"sei",
"vi",
"ni",
"sqrtni",
"lni"),
default="sei")
private$..yaxisInv <- jmvcore::OptionBool$new(
"yaxisInv",
yaxisInv,
default=FALSE)
private$..enhanceFunnel <- jmvcore::OptionBool$new(
"enhanceFunnel",
enhanceFunnel,
default=FALSE)
private$..lowerTOST <- jmvcore::OptionNumber$new(
"lowerTOST",
lowerTOST,
min=-100,
max=100,
default=-0.5)
private$..upperTOST <- jmvcore::OptionNumber$new(
"upperTOST",
upperTOST,
min=-100,
max=100,
default=0.5)
private$..alphaTOST <- jmvcore::OptionNumber$new(
"alphaTOST",
alphaTOST,
min=0.000001,
max=1,
default=0.05)
private$..showTestTOST <- jmvcore::OptionBool$new(
"showTestTOST",
showTestTOST,
default=TRUE)
private$..showInfPlot <- jmvcore::OptionBool$new(
"showInfPlot",
showInfPlot,
default=FALSE)
self$.addOption(private$..effectSize)
self$.addOption(private$..samplingVariances)
self$.addOption(private$..slab)
self$.addOption(private$..moderatorcor)
self$.addOption(private$..methodmetacor)
self$.addOption(private$..moderatorType)
self$.addOption(private$..level)
self$.addOption(private$..showModelFit)
self$.addOption(private$..addcred)
self$.addOption(private$..addfit)
self$.addOption(private$..showweights)
self$.addOption(private$..steps)
self$.addOption(private$..xAxisTitle)
self$.addOption(private$..pchForest)
self$.addOption(private$..forestOrder)
self$.addOption(private$..fsntype)
self$.addOption(private$..yaxis)
self$.addOption(private$..yaxisInv)
self$.addOption(private$..enhanceFunnel)
self$.addOption(private$..lowerTOST)
self$.addOption(private$..upperTOST)
self$.addOption(private$..alphaTOST)
self$.addOption(private$..showTestTOST)
self$.addOption(private$..showInfPlot)
}),
active = list(
effectSize = function() private$..effectSize$value,
samplingVariances = function() private$..samplingVariances$value,
slab = function() private$..slab$value,
moderatorcor = function() private$..moderatorcor$value,
methodmetacor = function() private$..methodmetacor$value,
moderatorType = function() private$..moderatorType$value,
level = function() private$..level$value,
showModelFit = function() private$..showModelFit$value,
addcred = function() private$..addcred$value,
addfit = function() private$..addfit$value,
showweights = function() private$..showweights$value,
steps = function() private$..steps$value,
xAxisTitle = function() private$..xAxisTitle$value,
pchForest = function() private$..pchForest$value,
forestOrder = function() private$..forestOrder$value,
fsntype = function() private$..fsntype$value,
yaxis = function() private$..yaxis$value,
yaxisInv = function() private$..yaxisInv$value,
enhanceFunnel = function() private$..enhanceFunnel$value,
lowerTOST = function() private$..lowerTOST$value,
upperTOST = function() private$..upperTOST$value,
alphaTOST = function() private$..alphaTOST$value,
showTestTOST = function() private$..showTestTOST$value,
showInfPlot = function() private$..showInfPlot$value),
private = list(
..effectSize = NA,
..samplingVariances = NA,
..slab = NA,
..moderatorcor = NA,
..methodmetacor = NA,
..moderatorType = NA,
..level = NA,
..showModelFit = NA,
..addcred = NA,
..addfit = NA,
..showweights = NA,
..steps = NA,
..xAxisTitle = NA,
..pchForest = NA,
..forestOrder = NA,
..fsntype = NA,
..yaxis = NA,
..yaxisInv = NA,
..enhanceFunnel = NA,
..lowerTOST = NA,
..upperTOST = NA,
..alphaTOST = NA,
..showTestTOST = NA,
..showInfPlot = NA)
)
metaDVResults <- if (requireNamespace('jmvcore')) R6::R6Class(
inherit = jmvcore::Group,
active = list(
textRICH = function() private$.items[["textRICH"]],
tableTauSqaured = function() private$.items[["tableTauSqaured"]],
modelFitRICH = function() private$.items[["modelFitRICH"]],
plot = function() private$.items[["plot"]],
fsnRICH = function() private$.items[["fsnRICH"]],
funplot = function() private$.items[["funplot"]],
TOSToutput = function() private$.items[["TOSToutput"]],
TOSToutputtext = function() private$.items[["TOSToutputtext"]],
tostplot = function() private$.items[["tostplot"]],
diagPlotAll = function() private$.items[["diagPlotAll"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Meta-Analysis")
self$add(jmvcore::Table$new(
options=options,
name="textRICH",
refs=list(
"metafor"),
title="Random-Effects Model",
rows=2,
columns=list(
list(
`name`="Intercept",
`title`="",
`type`="text"),
list(
`name`="Estimate",
`type`="number"),
list(
`name`="se",
`type`="number"),
list(
`name`="Z",
`type`="number"),
list(
`name`="p",
`type`="number",
`format`="zto,pvalue"),
list(
`name`="CILow",
`title`="CI Lower Bound",
`type`="number",
`format`="zto"),
list(
`name`="CIHigh",
`title`="CI Upper Bound",
`type`="number",
`format`="zto"))))
self$add(jmvcore::Table$new(
options=options,
name="tableTauSqaured",
title="Heterogeneity Statistics",
rows=1,
columns=list(
list(
`name`="tauSQRT",
`title`="Tau",
`type`="number",
`format`="zto"),
list(
`name`="tauSqComb",
`title`="Tau\u00B2",
`type`="number",
`format`="zto"),
list(
`name`="ISqu",
`title`="I\u00B2",
`type`="text"),
list(
`name`="HSqu",
`title`="H\u00B2",
`type`="number",
`format`="zto"),
list(
`name`="RSqu",
`title`="R\u00B2",
`type`="text"),
list(
`name`="QallDF",
`title`="df",
`type`="integer",
`format`="zto"),
list(
`name`="Qall",
`title`="Q",
`type`="number",
`format`="zto"),
list(
`name`="QallPval",
`title`="p",
`type`="number",
`format`="zto,pvalue"))))
self$add(jmvcore::Table$new(
options=options,
name="modelFitRICH",
title="Model Fit Statistics and Information Criteria",
rows=2,
columns=list(
list(
`name`="label",
`title`="",
`type`="text"),
list(
`name`="loglikelihood",
`title`="log-likelihood",
`type`="number",
`format`="zto"),
list(
`name`="deviance",
`title`="Deviance",
`type`="number",
`format`="zto"),
list(
`name`="AIC",
`type`="number",
`format`="zto"),
list(
`name`="BIC",
`type`="number",
`format`="zto"),
list(
`name`="AICc",
`type`="number",
`format`="zto"))))
self$add(jmvcore::Image$new(
options=options,
name="plot",
title="Forest Plot",
width=600,
height=450,
renderFun=".plot",
refs=list(
"metafor")))
self$add(jmvcore::Table$new(
options=options,
name="fsnRICH",
title="",
rows=3,
columns=list(
list(
`name`="label",
`title`="Test Name",
`type`="text"),
list(
`name`="failSafeNumber",
`title`="value",
`type`="integer",
`format`="zto"),
list(
`name`="p",
`type`="number",
`format`="zto,pvalue"))))
self$add(jmvcore::Image$new(
options=options,
name="funplot",
title="Funnel Plot",
width=600,
height=450,
renderFun=".funplot",
refs=list(
"metafor")))
self$add(jmvcore::Table$new(
options=options,
name="TOSToutput",
title="Two One-Sided Tests Equivalence Testing",
refs=list(
"TOSTER"),
rows=1,
columns=list(
list(
`name`="TOST_Z1",
`title`="Z-Value Lower Bound",
`type`="number",
`format`="zto"),
list(
`name`="TOST_p1",
`title`="P-Value Lower Bound",
`type`="number",
`format`="zto,pvalue"),
list(
`name`="TOST_Z2",
`title`="Z-Value Upper Bound",
`type`="number",
`format`="zto"),
list(
`name`="TOST_p2",
`title`="P-Value Upper Bound",
`type`="number",
`format`="zto"),
list(
`name`="LL_CI_TOST",
`type`="number",
`format`="zto"),
list(
`name`="UL_CI_TOST",
`type`="number",
`format`="zto,pvalue"),
list(
`name`="LL_CI_ZTEST",
`type`="number",
`format`="zto"),
list(
`name`="UL_CI_ZTEST",
`type`="number",
`format`="zto"))))
self$add(jmvcore::Preformatted$new(
options=options,
name="TOSToutputtext",
title="Two One-Sided Tests Equivalence Testing: Text Summary"))
self$add(jmvcore::Image$new(
options=options,
name="tostplot",
title="Equivalence Test Plot",
width=600,
height=450,
renderFun=".tostplot",
refs=list(
"TOSTER")))
self$add(R6::R6Class(
inherit = jmvcore::Group,
active = list(
diagplot1 = function() private$.items[["diagplot1"]],
diagplot2 = function() private$.items[["diagplot2"]],
diagplot3 = function() private$.items[["diagplot3"]],
diagplot4 = function() private$.items[["diagplot4"]],
diagplot5 = function() private$.items[["diagplot5"]],
diagplot6 = function() private$.items[["diagplot6"]],
diagplot7 = function() private$.items[["diagplot7"]],
diagplot8 = function() private$.items[["diagplot8"]],
diagplot9 = function() private$.items[["diagplot9"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="diagPlotAll",
title="Outlier and Influential Case Diagnostics")
self$add(jmvcore::Image$new(
options=options,
name="diagplot1",
title="Externally Standardized Residual",
width=750,
height=300,
renderFun=".influDiagPlot1"))
self$add(jmvcore::Image$new(
options=options,
name="diagplot2",
title="DFFITS Values",
width=750,
height=300,
renderFun=".influDiagPlot2"))
self$add(jmvcore::Image$new(
options=options,
name="diagplot3",
title="Cook's Distances",
width=750,
height=300,
renderFun=".influDiagPlot3"))
self$add(jmvcore::Image$new(
options=options,
name="diagplot4",
title="Covariance Ratios",
width=750,
height=300,
renderFun=".influDiagPlot4"))
self$add(jmvcore::Image$new(
options=options,
name="diagplot5",
title="Leave-one-out Tau Estimates",
width=750,
height=300,
renderFun=".influDiagPlot5"))
self$add(jmvcore::Image$new(
options=options,
name="diagplot6",
title="Leave-one-out (residual) Heterogeneity Test Statistics",
width=750,
height=300,
renderFun=".influDiagPlot6"))
self$add(jmvcore::Image$new(
options=options,
name="diagplot7",
title="Hat Values",
width=750,
height=300,
renderFun=".influDiagPlot7"))
self$add(jmvcore::Image$new(
options=options,
name="diagplot8",
title="Weights",
width=750,
height=300,
renderFun=".influDiagPlot8"))
self$add(jmvcore::Image$new(
options=options,
name="diagplot9",
title="Q-Q Plot",
width=700,
height=700,
renderFun=".influDiagPlot9"))}))$new(options=options))}))
metaDVBase <- if (requireNamespace('jmvcore')) R6::R6Class(
"metaDVBase",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = 'MAJOR',
name = 'metaDV',
version = c(1,0,0),
options = options,
results = metaDVResults$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE)
}))
#' Effect Sizes and Sampling Variances
#'
#'
#' @param data .
#' @param effectSize .
#' @param samplingVariances .
#' @param slab .
#' @param moderatorcor .
#' @param methodmetacor .
#' @param moderatorType .
#' @param level .
#' @param showModelFit .
#' @param addcred .
#' @param addfit .
#' @param showweights .
#' @param steps .
#' @param xAxisTitle .
#' @param pchForest .
#' @param forestOrder .
#' @param fsntype .
#' @param yaxis .
#' @param yaxisInv .
#' @param enhanceFunnel .
#' @param lowerTOST .
#' @param upperTOST .
#' @param alphaTOST .
#' @param showTestTOST .
#' @param showInfPlot .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$textRICH} \tab \tab \tab \tab \tab a table \cr
#' \code{results$tableTauSqaured} \tab \tab \tab \tab \tab a table \cr
#' \code{results$modelFitRICH} \tab \tab \tab \tab \tab a table \cr
#' \code{results$plot} \tab \tab \tab \tab \tab an image \cr
#' \code{results$fsnRICH} \tab \tab \tab \tab \tab a table \cr
#' \code{results$funplot} \tab \tab \tab \tab \tab an image \cr
#' \code{results$TOSToutput} \tab \tab \tab \tab \tab a table \cr
#' \code{results$TOSToutputtext} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$tostplot} \tab \tab \tab \tab \tab an image \cr
#' \code{results$diagPlotAll$diagplot1} \tab \tab \tab \tab \tab an image \cr
#' \code{results$diagPlotAll$diagplot2} \tab \tab \tab \tab \tab an image \cr
#' \code{results$diagPlotAll$diagplot3} \tab \tab \tab \tab \tab an image \cr
#' \code{results$diagPlotAll$diagplot4} \tab \tab \tab \tab \tab an image \cr
#' \code{results$diagPlotAll$diagplot5} \tab \tab \tab \tab \tab an image \cr
#' \code{results$diagPlotAll$diagplot6} \tab \tab \tab \tab \tab an image \cr
#' \code{results$diagPlotAll$diagplot7} \tab \tab \tab \tab \tab an image \cr
#' \code{results$diagPlotAll$diagplot8} \tab \tab \tab \tab \tab an image \cr
#' \code{results$diagPlotAll$diagplot9} \tab \tab \tab \tab \tab an image \cr
#' }
#'
#' Tables can be converted to data frames with \code{asDF} or \code{\link{as.data.frame}}. For example:
#'
#' \code{results$textRICH$asDF}
#'
#' \code{as.data.frame(results$textRICH)}
#'
#' @export
metaDV <- function(
data,
effectSize,
samplingVariances,
slab,
moderatorcor,
methodmetacor = "REML",
moderatorType = "NON",
level = 95,
showModelFit = FALSE,
addcred = FALSE,
addfit = TRUE,
showweights = FALSE,
steps = 5,
xAxisTitle,
pchForest = "15",
forestOrder = "fit",
fsntype = "Rosenthal",
yaxis = "sei",
yaxisInv = FALSE,
enhanceFunnel = FALSE,
lowerTOST = -0.5,
upperTOST = 0.5,
alphaTOST = 0.05,
showTestTOST = TRUE,
showInfPlot = FALSE) {
if ( ! requireNamespace('jmvcore'))
stop('metaDV requires jmvcore to be installed (restart may be required)')
if ( ! missing(effectSize)) effectSize <- jmvcore::resolveQuo(jmvcore::enquo(effectSize))
if ( ! missing(samplingVariances)) samplingVariances <- jmvcore::resolveQuo(jmvcore::enquo(samplingVariances))
if ( ! missing(slab)) slab <- jmvcore::resolveQuo(jmvcore::enquo(slab))
if ( ! missing(moderatorcor)) moderatorcor <- jmvcore::resolveQuo(jmvcore::enquo(moderatorcor))
if (missing(data))
data <- jmvcore::marshalData(
parent.frame(),
`if`( ! missing(effectSize), effectSize, NULL),
`if`( ! missing(samplingVariances), samplingVariances, NULL),
`if`( ! missing(slab), slab, NULL),
`if`( ! missing(moderatorcor), moderatorcor, NULL))
options <- metaDVOptions$new(
effectSize = effectSize,
samplingVariances = samplingVariances,
slab = slab,
moderatorcor = moderatorcor,
methodmetacor = methodmetacor,
moderatorType = moderatorType,
level = level,
showModelFit = showModelFit,
addcred = addcred,
addfit = addfit,
showweights = showweights,
steps = steps,
xAxisTitle = xAxisTitle,
pchForest = pchForest,
forestOrder = forestOrder,
fsntype = fsntype,
yaxis = yaxis,
yaxisInv = yaxisInv,
enhanceFunnel = enhanceFunnel,
lowerTOST = lowerTOST,
upperTOST = upperTOST,
alphaTOST = alphaTOST,
showTestTOST = showTestTOST,
showInfPlot = showInfPlot)
analysis <- metaDVClass$new(
options = options,
data = data)
analysis$run()
analysis$results
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.