# This file is automatically generated, you probably don't want to edit this
clrOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"clrOptions",
inherit = jmvcore::Options,
public = list(
initialize = function(
vars = NULL,
group = NULL,
model = "RM",
num = 1,
ci = 3,
clr = TRUE,
resi = FALSE,
score = NULL,
dif = FALSE,
plot = FALSE,
plot1 = FALSE,
plot2 = FALSE,
width = 500,
height = 500,
width1 = 500,
height1 = 500,
width2 = 500,
height2 = 500, ...) {
super$initialize(
package="snowIRT",
name="clr",
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"))
private$..model <- jmvcore::OptionList$new(
"model",
model,
options=list(
"RM",
"PCM"),
default="RM")
private$..num <- jmvcore::OptionInteger$new(
"num",
num,
default=1,
min=1)
private$..ci <- jmvcore::OptionInteger$new(
"ci",
ci,
default=3,
min=2)
private$..clr <- jmvcore::OptionBool$new(
"clr",
clr,
default=TRUE)
private$..resi <- jmvcore::OptionBool$new(
"resi",
resi,
default=FALSE)
private$..score <- jmvcore::OptionList$new(
"score",
score,
options=list(
"low",
"high"))
private$..dif <- jmvcore::OptionBool$new(
"dif",
dif,
default=FALSE)
private$..plot <- jmvcore::OptionBool$new(
"plot",
plot,
default=FALSE)
private$..plot1 <- jmvcore::OptionBool$new(
"plot1",
plot1,
default=FALSE)
private$..plot2 <- jmvcore::OptionBool$new(
"plot2",
plot2,
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)
private$..width2 <- jmvcore::OptionInteger$new(
"width2",
width2,
default=500)
private$..height2 <- jmvcore::OptionInteger$new(
"height2",
height2,
default=500)
self$.addOption(private$..vars)
self$.addOption(private$..group)
self$.addOption(private$..model)
self$.addOption(private$..num)
self$.addOption(private$..ci)
self$.addOption(private$..clr)
self$.addOption(private$..resi)
self$.addOption(private$..score)
self$.addOption(private$..dif)
self$.addOption(private$..plot)
self$.addOption(private$..plot1)
self$.addOption(private$..plot2)
self$.addOption(private$..width)
self$.addOption(private$..height)
self$.addOption(private$..width1)
self$.addOption(private$..height1)
self$.addOption(private$..width2)
self$.addOption(private$..height2)
}),
active = list(
vars = function() private$..vars$value,
group = function() private$..group$value,
model = function() private$..model$value,
num = function() private$..num$value,
ci = function() private$..ci$value,
clr = function() private$..clr$value,
resi = function() private$..resi$value,
score = function() private$..score$value,
dif = function() private$..dif$value,
plot = function() private$..plot$value,
plot1 = function() private$..plot1$value,
plot2 = function() private$..plot2$value,
width = function() private$..width$value,
height = function() private$..height$value,
width1 = function() private$..width1$value,
height1 = function() private$..height1$value,
width2 = function() private$..width2$value,
height2 = function() private$..height2$value),
private = list(
..vars = NA,
..group = NA,
..model = NA,
..num = NA,
..ci = NA,
..clr = NA,
..resi = NA,
..score = NA,
..dif = NA,
..plot = NA,
..plot1 = NA,
..plot2 = NA,
..width = NA,
..height = NA,
..width1 = NA,
..height1 = NA,
..width2 = NA,
..height2 = NA)
)
clrResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"clrResults",
inherit = jmvcore::Group,
active = list(
instructions = function() private$.items[["instructions"]],
clr = function() private$.items[["clr"]],
resi = function() private$.items[["resi"]],
dif = function() private$.items[["dif"]],
plot = function() private$.items[["plot"]],
plot1 = function() private$.items[["plot1"]],
plot2 = function() private$.items[["plot2"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Conditional Likelihood Ratio Test",
refs="snowIRT")
self$add(jmvcore::Html$new(
options=options,
name="instructions",
title="Instructions",
visible=TRUE))
self$add(jmvcore::Table$new(
options=options,
name="clr",
title="Conditional Likelihood Ratio Test",
visible="(clr)",
clearWith=list(
"vars",
"group",
"model"),
refs="iarm",
columns=list(
list(
`name`="name",
`title`="",
`type`="text"),
list(
`name`="clr",
`title`="Value",
`type`="number"),
list(
`name`="df",
`title`="df",
`type`="integer"),
list(
`name`="p",
`title`="p",
`format`="zto,pvalue"))))
self$add(jmvcore::Table$new(
options=options,
name="resi",
title="`Standardized residuals - ${score}`",
rows="(vars)",
visible="(resi)",
clearWith=list(
"vars",
"group",
"model",
"score"),
refs="iarm",
columns=list(
list(
`name`="name",
`title`="",
`type`="text",
`content`="($key)"),
list(
`name`="obs",
`title`="Observed",
`type`="number"),
list(
`name`="exp",
`title`="Expexted",
`type`="number"),
list(
`name`="std",
`title`="Std.residuals",
`type`="number"),
list(
`name`="sig",
`title`="Sig.",
`type`="text"))))
self$add(jmvcore::Table$new(
options=options,
name="dif",
title="Partial Gamma Coefficients for DIF",
visible="(dif)",
rows="(vars)",
clearWith=list(
"vars",
"group",
"model",
"padjust"),
refs="iarm",
columns=list(
list(
`name`="name",
`title`="",
`type`="text",
`content`="($key)"),
list(
`name`="gamma",
`title`="Estimate",
`type`="number"),
list(
`name`="se",
`title`="SE",
`type`="number"),
list(
`name`="p",
`title`="p",
`format`="zto,pvalue"),
list(
`name`="lower",
`title`="Lower",
`type`="number",
`superTitle`="95% CI"),
list(
`name`="upper",
`title`="Upper",
`type`="number",
`superTitle`="95% CI"))))
self$add(jmvcore::Image$new(
options=options,
name="plot",
title="Item Characteristic Curve(ICC)",
visible="(plot)",
renderFun=".plot",
refs="iarm",
clearWith=list(
"vars",
"group",
"model",
"num",
"width",
"height")))
self$add(jmvcore::Image$new(
options=options,
name="plot1",
title="DIF using total scores",
visible="(plot1)",
renderFun=".plot1",
refs="iarm",
clearWith=list(
"vars",
"group",
"model",
"num",
"width1",
"height1")))
self$add(jmvcore::Image$new(
options=options,
name="plot2",
title="DIF using class intervals",
visible="(plot2)",
renderFun=".plot2",
refs="iarm",
clearWith=list(
"vars",
"group",
"model",
"num",
"ci",
"width2",
"height2")))}))
clrBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"clrBase",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = "snowIRT",
name = "clr",
version = c(1,0,0),
options = options,
results = clrResults$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE,
weightsSupport = 'auto')
}))
#' Conditional Likelihood Ratio Test
#'
#'
#' @param data The data as a data frame.
#' @param vars .
#' @param group A string naming the grouping variable from \code{data}
#' @param model .
#' @param num .
#' @param ci .
#' @param clr .
#' @param resi .
#' @param score .
#' @param dif .
#' @param plot .
#' @param plot1 .
#' @param plot2 .
#' @param width .
#' @param height .
#' @param width1 .
#' @param height1 .
#' @param width2 .
#' @param height2 .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$instructions} \tab \tab \tab \tab \tab a html \cr
#' \code{results$clr} \tab \tab \tab \tab \tab a table \cr
#' \code{results$resi} \tab \tab \tab \tab \tab a table \cr
#' \code{results$dif} \tab \tab \tab \tab \tab a table \cr
#' \code{results$plot} \tab \tab \tab \tab \tab an image \cr
#' \code{results$plot1} \tab \tab \tab \tab \tab an image \cr
#' \code{results$plot2} \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$clr$asDF}
#'
#' \code{as.data.frame(results$clr)}
#'
#' @export
clr <- function(
data,
vars,
group,
model = "RM",
num = 1,
ci = 3,
clr = TRUE,
resi = FALSE,
score,
dif = FALSE,
plot = FALSE,
plot1 = FALSE,
plot2 = FALSE,
width = 500,
height = 500,
width1 = 500,
height1 = 500,
width2 = 500,
height2 = 500) {
if ( ! requireNamespace("jmvcore", quietly=TRUE))
stop("clr 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))
for (v in group) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
options <- clrOptions$new(
vars = vars,
group = group,
model = model,
num = num,
ci = ci,
clr = clr,
resi = resi,
score = score,
dif = dif,
plot = plot,
plot1 = plot1,
plot2 = plot2,
width = width,
height = height,
width1 = width1,
height1 = height1,
width2 = width2,
height2 = height2)
analysis <- clrClass$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.