# This file is automatically generated, you probably don't want to edit this
deltamOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"deltamOptions",
inherit = jmvcore::Options,
public = list(
initialize = function(
vars = NULL,
group = NULL,
fixed = TRUE,
plot = FALSE,
normal = FALSE,
puri = NULL,
plot1 = FALSE,
width = 500,
height = 500,
width1 = 500,
height1 = 500, ...) {
super$initialize(
package="snowIRT",
name="deltam",
requiresData=TRUE,
...)
private$..vars <- jmvcore::OptionVariables$new(
"vars",
vars,
suggested=list(
"continuous"),
permitted=list(
"numeric"))
private$..group <- jmvcore::OptionVariable$new(
"group",
group,
suggested=list(
"nominal"),
permitted=list(
"factor",
"numeric"))
private$..fixed <- jmvcore::OptionBool$new(
"fixed",
fixed,
default=TRUE)
private$..plot <- jmvcore::OptionBool$new(
"plot",
plot,
default=FALSE)
private$..normal <- jmvcore::OptionBool$new(
"normal",
normal,
default=FALSE)
private$..puri <- jmvcore::OptionList$new(
"puri",
puri,
options=list(
"IPP1",
"IPP2",
"IPP3"))
private$..plot1 <- jmvcore::OptionBool$new(
"plot1",
plot1,
default=FALSE)
private$..width <- jmvcore::OptionInteger$new(
"width",
width,
default=500)
private$..height <- jmvcore::OptionInteger$new(
"height",
height,
default=500)
private$..width1 <- jmvcore::OptionInteger$new(
"width1",
width1,
default=500)
private$..height1 <- jmvcore::OptionInteger$new(
"height1",
height1,
default=500)
self$.addOption(private$..vars)
self$.addOption(private$..group)
self$.addOption(private$..fixed)
self$.addOption(private$..plot)
self$.addOption(private$..normal)
self$.addOption(private$..puri)
self$.addOption(private$..plot1)
self$.addOption(private$..width)
self$.addOption(private$..height)
self$.addOption(private$..width1)
self$.addOption(private$..height1)
}),
active = list(
vars = function() private$..vars$value,
group = function() private$..group$value,
fixed = function() private$..fixed$value,
plot = function() private$..plot$value,
normal = function() private$..normal$value,
puri = function() private$..puri$value,
plot1 = function() private$..plot1$value,
width = function() private$..width$value,
height = function() private$..height$value,
width1 = function() private$..width1$value,
height1 = function() private$..height1$value),
private = list(
..vars = NA,
..group = NA,
..fixed = NA,
..plot = NA,
..normal = NA,
..puri = NA,
..plot1 = NA,
..width = NA,
..height = NA,
..width1 = NA,
..height1 = NA)
)
deltamResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"deltamResults",
inherit = jmvcore::Group,
active = list(
instructions = function() private$.items[["instructions"]],
fixed = function() private$.items[["fixed"]],
text = function() private$.items[["text"]],
plot = function() private$.items[["plot"]],
normal = function() private$.items[["normal"]],
text1 = function() private$.items[["text1"]],
text2 = function() private$.items[["text2"]],
plot1 = function() private$.items[["plot1"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Delta method",
refs="snowIRT")
self$add(jmvcore::Html$new(
options=options,
name="instructions",
title="Instructions",
visible=TRUE))
self$add(jmvcore::Table$new(
options=options,
name="fixed",
title="Fixed method",
visible="(fixed)",
rows="(vars)",
clearWith=list(
"vars",
"group"),
refs="ShinyItemAnalysis",
columns=list(
list(
`name`="name",
`title`="Item",
`type`="text",
`content`="($key)"),
list(
`name`="pr",
`title`="Prop.Reference"),
list(
`name`="pf",
`title`="Prop.Focal"),
list(
`name`="dr",
`title`="Delta.Reference"),
list(
`name`="df",
`title`="Delta.Focal"),
list(
`name`="dist",
`title`="Distance"))))
self$add(jmvcore::Preformatted$new(
options=options,
name="text",
title="Fixed DIF item(s)"))
self$add(jmvcore::Image$new(
options=options,
name="plot",
title="Fixed DIF",
visible="(plot)",
renderFun=".plot",
clearWith=list(
"vars",
"group",
"width",
"height")))
self$add(jmvcore::Table$new(
options=options,
name="normal",
title="Perpendicular distances(after the last iteration)",
visible="(normal)",
clearWith=list(
"vars",
"group",
"puri"),
refs="ShinyItemAnalysis",
columns=list(
list(
`name`="name",
`title`="Item",
`type`="text",
`content`="($key)"))))
self$add(jmvcore::Preformatted$new(
options=options,
name="text1",
title="Normal DIF item(s)"))
self$add(jmvcore::Preformatted$new(
options=options,
name="text2",
title="Threshold value(s) during the purification process"))
self$add(jmvcore::Image$new(
options=options,
name="plot1",
title="Normal DIF",
visible="(plot1)",
renderFun=".plot1",
clearWith=list(
"vars",
"group",
"width1",
"height1")))}))
deltamBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"deltamBase",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = "snowIRT",
name = "deltam",
version = c(1,0,0),
options = options,
results = deltamResults$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE,
weightsSupport = 'auto')
}))
#' Delta method
#'
#'
#' @param data The data as a data frame.
#' @param vars .
#' @param group A string naming the grouping variable from \code{data}
#' @param fixed .
#' @param plot .
#' @param normal .
#' @param puri .
#' @param plot1 .
#' @param width .
#' @param height .
#' @param width1 .
#' @param height1 .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$instructions} \tab \tab \tab \tab \tab a html \cr
#' \code{results$fixed} \tab \tab \tab \tab \tab a table \cr
#' \code{results$text} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$plot} \tab \tab \tab \tab \tab an image \cr
#' \code{results$normal} \tab \tab \tab \tab \tab a table \cr
#' \code{results$text1} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$text2} \tab \tab \tab \tab \tab a preformatted \cr
#' \code{results$plot1} \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$fixed$asDF}
#'
#' \code{as.data.frame(results$fixed)}
#'
#' @export
deltam <- function(
data,
vars,
group,
fixed = TRUE,
plot = FALSE,
normal = FALSE,
puri,
plot1 = FALSE,
width = 500,
height = 500,
width1 = 500,
height1 = 500) {
if ( ! requireNamespace("jmvcore", quietly=TRUE))
stop("deltam requires jmvcore to be installed (restart may be required)")
if ( ! missing(vars)) vars <- jmvcore::resolveQuo(jmvcore::enquo(vars))
if ( ! missing(group)) group <- jmvcore::resolveQuo(jmvcore::enquo(group))
if (missing(data))
data <- jmvcore::marshalData(
parent.frame(),
`if`( ! missing(vars), vars, NULL),
`if`( ! missing(group), group, NULL))
options <- deltamOptions$new(
vars = vars,
group = group,
fixed = fixed,
plot = plot,
normal = normal,
puri = puri,
plot1 = plot1,
width = width,
height = height,
width1 = width1,
height1 = height1)
analysis <- deltamClass$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.