# This file is automatically generated, you probably don't want to edit this
logitOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"logitOptions",
inherit = jmvcore::Options,
public = list(
initialize = function(
vars = NULL,
group = NULL,
model = "adjacent",
type = "both",
match = "zscore",
padjust = "BH",
method = TRUE,
puri = FALSE,
num = 1,
plot = TRUE,
width = 500,
height = 500, ...) {
super$initialize(
package="snowIRT",
name="logit",
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$..model <- jmvcore::OptionList$new(
"model",
model,
options=list(
"adjacent",
"cumulative"),
default="adjacent")
private$..type <- jmvcore::OptionList$new(
"type",
type,
options=list(
"both",
"udif",
"nudif"),
default="both")
private$..match <- jmvcore::OptionList$new(
"match",
match,
options=list(
"zscore",
"score"),
default="zscore")
private$..padjust <- jmvcore::OptionList$new(
"padjust",
padjust,
options=list(
"none",
"holm",
"hochberg",
"hommel",
"bonferroni",
"BH",
"BY",
"fdr"),
default="BH")
private$..method <- jmvcore::OptionBool$new(
"method",
method,
default=TRUE)
private$..puri <- jmvcore::OptionBool$new(
"puri",
puri,
default=FALSE)
private$..num <- jmvcore::OptionInteger$new(
"num",
num,
default=1,
min=1)
private$..plot <- jmvcore::OptionBool$new(
"plot",
plot,
default=TRUE)
private$..width <- jmvcore::OptionInteger$new(
"width",
width,
default=500)
private$..height <- jmvcore::OptionInteger$new(
"height",
height,
default=500)
self$.addOption(private$..vars)
self$.addOption(private$..group)
self$.addOption(private$..model)
self$.addOption(private$..type)
self$.addOption(private$..match)
self$.addOption(private$..padjust)
self$.addOption(private$..method)
self$.addOption(private$..puri)
self$.addOption(private$..num)
self$.addOption(private$..plot)
self$.addOption(private$..width)
self$.addOption(private$..height)
}),
active = list(
vars = function() private$..vars$value,
group = function() private$..group$value,
model = function() private$..model$value,
type = function() private$..type$value,
match = function() private$..match$value,
padjust = function() private$..padjust$value,
method = function() private$..method$value,
puri = function() private$..puri$value,
num = function() private$..num$value,
plot = function() private$..plot$value,
width = function() private$..width$value,
height = function() private$..height$value),
private = list(
..vars = NA,
..group = NA,
..model = NA,
..type = NA,
..match = NA,
..padjust = NA,
..method = NA,
..puri = NA,
..num = NA,
..plot = NA,
..width = NA,
..height = NA)
)
logitResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"logitResults",
inherit = jmvcore::Group,
active = list(
instructions = function() private$.items[["instructions"]],
method = function() private$.items[["method"]],
plot = function() private$.items[["plot"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="DIF for ordinal data",
refs="snowIRT")
self$add(jmvcore::Html$new(
options=options,
name="instructions",
title="Instructions",
visible=TRUE))
self$add(jmvcore::Table$new(
options=options,
name="method",
title="`Likelihood ratio Chi-square statistics - ${padjust}`",
visible="(method)",
rows="(vars)",
clearWith=list(
"vars",
"group",
"model",
"type",
"match",
"padjust"),
refs="difNLR",
columns=list(
list(
`name`="name",
`title`="",
`type`="text",
`content`="($key)"),
list(
`name`="chi",
`title`="Statistic",
`type`="number"),
list(
`name`="p",
`title`="p",
`format`="zto,pvalue"),
list(
`name`="padj",
`title`="Adj.p",
`format`="zto,pvalue"))))
self$add(jmvcore::Image$new(
options=options,
name="plot",
title="ICC plot",
visible="(plot)",
renderFun=".plot",
refs="difNLR",
clearWith=list(
"vars",
"group",
"model",
"type",
"match",
"padjust",
"num",
"width",
"height")))}))
logitBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"logitBase",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = "snowIRT",
name = "logit",
version = c(1,0,0),
options = options,
results = logitResults$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE,
weightsSupport = 'auto')
}))
#' DIF for ordinal data
#'
#'
#' @param data The data as a data frame.
#' @param vars .
#' @param group A string naming the grouping variable from \code{data}
#' @param model .
#' @param type .
#' @param match .
#' @param padjust .
#' @param method .
#' @param puri .
#' @param num .
#' @param plot .
#' @param width .
#' @param height .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$instructions} \tab \tab \tab \tab \tab a html \cr
#' \code{results$method} \tab \tab \tab \tab \tab a table \cr
#' \code{results$plot} \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$method$asDF}
#'
#' \code{as.data.frame(results$method)}
#'
#' @export
logit <- function(
data,
vars,
group,
model = "adjacent",
type = "both",
match = "zscore",
padjust = "BH",
method = TRUE,
puri = FALSE,
num = 1,
plot = TRUE,
width = 500,
height = 500) {
if ( ! requireNamespace("jmvcore", quietly=TRUE))
stop("logit 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 <- logitOptions$new(
vars = vars,
group = group,
model = model,
type = type,
match = match,
padjust = padjust,
method = method,
puri = puri,
num = num,
plot = plot,
width = width,
height = height)
analysis <- logitClass$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.