# This file is automatically generated, you probably don't want to edit this
gtheoryOptions <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"gtheoryOptions",
inherit = jmvcore::Options,
public = list(
initialize = function(
dep = NULL,
id = NULL,
sub = NULL,
ng = 2,
nf = 1,
facet = NULL,
g = FALSE,
d = FALSE,
formula = "value ~ (1 | subject) + (1 | task) + (1 | rater:task) + (1 | subject:task)",
mea = FALSE,
gmea = FALSE,
item = FALSE,
formula1 = "Score ~ (1 | Person) + (1 | Item)",
t = "uni",
itemd = FALSE,
comp = FALSE,
bm = FALSE,
mat = FALSE,
bmat = FALSE,
plot1 = FALSE,
width = 500,
height = 500,
gco = "TRUE", ...) {
super$initialize(
package="seolmatrix",
name="gtheory",
requiresData=TRUE,
...)
private$..dep <- jmvcore::OptionVariable$new(
"dep",
dep,
suggested=list(
"continuous"),
permitted=list(
"numeric"))
private$..id <- jmvcore::OptionVariable$new(
"id",
id,
suggested=list(
"nominal"),
permitted=list(
"factor"))
private$..sub <- jmvcore::OptionVariable$new(
"sub",
sub,
suggested=list(
"nominal"),
permitted=list(
"factor"))
private$..ng <- jmvcore::OptionInteger$new(
"ng",
ng,
min=2,
default=2)
private$..nf <- jmvcore::OptionInteger$new(
"nf",
nf,
min=1,
default=1)
private$..facet <- jmvcore::OptionVariables$new(
"facet",
facet,
suggested=list(
"nominal"),
permitted=list(
"factor"))
private$..g <- jmvcore::OptionBool$new(
"g",
g,
default=FALSE)
private$..d <- jmvcore::OptionBool$new(
"d",
d,
default=FALSE)
private$..formula <- jmvcore::OptionString$new(
"formula",
formula,
default="value ~ (1 | subject) + (1 | task) + (1 | rater:task) + (1 | subject:task)")
private$..mea <- jmvcore::OptionBool$new(
"mea",
mea,
default=FALSE)
private$..gmea <- jmvcore::OptionBool$new(
"gmea",
gmea,
default=FALSE)
private$..item <- jmvcore::OptionBool$new(
"item",
item,
default=FALSE)
private$..formula1 <- jmvcore::OptionString$new(
"formula1",
formula1,
default="Score ~ (1 | Person) + (1 | Item)")
private$..t <- jmvcore::OptionList$new(
"t",
t,
options=list(
"uni",
"mul"),
default="uni")
private$..itemd <- jmvcore::OptionBool$new(
"itemd",
itemd,
default=FALSE)
private$..comp <- jmvcore::OptionBool$new(
"comp",
comp,
default=FALSE)
private$..bm <- jmvcore::OptionBool$new(
"bm",
bm,
default=FALSE)
private$..mat <- jmvcore::OptionBool$new(
"mat",
mat,
default=FALSE)
private$..bmat <- jmvcore::OptionBool$new(
"bmat",
bmat,
default=FALSE)
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$..gco <- jmvcore::OptionList$new(
"gco",
gco,
options=list(
"TRUE",
"FALSE"),
default="TRUE")
self$.addOption(private$..dep)
self$.addOption(private$..id)
self$.addOption(private$..sub)
self$.addOption(private$..ng)
self$.addOption(private$..nf)
self$.addOption(private$..facet)
self$.addOption(private$..g)
self$.addOption(private$..d)
self$.addOption(private$..formula)
self$.addOption(private$..mea)
self$.addOption(private$..gmea)
self$.addOption(private$..item)
self$.addOption(private$..formula1)
self$.addOption(private$..t)
self$.addOption(private$..itemd)
self$.addOption(private$..comp)
self$.addOption(private$..bm)
self$.addOption(private$..mat)
self$.addOption(private$..bmat)
self$.addOption(private$..plot1)
self$.addOption(private$..width)
self$.addOption(private$..height)
self$.addOption(private$..gco)
}),
active = list(
dep = function() private$..dep$value,
id = function() private$..id$value,
sub = function() private$..sub$value,
ng = function() private$..ng$value,
nf = function() private$..nf$value,
facet = function() private$..facet$value,
g = function() private$..g$value,
d = function() private$..d$value,
formula = function() private$..formula$value,
mea = function() private$..mea$value,
gmea = function() private$..gmea$value,
item = function() private$..item$value,
formula1 = function() private$..formula1$value,
t = function() private$..t$value,
itemd = function() private$..itemd$value,
comp = function() private$..comp$value,
bm = function() private$..bm$value,
mat = function() private$..mat$value,
bmat = function() private$..bmat$value,
plot1 = function() private$..plot1$value,
width = function() private$..width$value,
height = function() private$..height$value,
gco = function() private$..gco$value),
private = list(
..dep = NA,
..id = NA,
..sub = NA,
..ng = NA,
..nf = NA,
..facet = NA,
..g = NA,
..d = NA,
..formula = NA,
..mea = NA,
..gmea = NA,
..item = NA,
..formula1 = NA,
..t = NA,
..itemd = NA,
..comp = NA,
..bm = NA,
..mat = NA,
..bmat = NA,
..plot1 = NA,
..width = NA,
..height = NA,
..gco = NA)
)
gtheoryResults <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"gtheoryResults",
inherit = jmvcore::Group,
active = list(
instructions = function() private$.items[["instructions"]],
g = function() private$.items[["g"]],
gmea = function() private$.items[["gmea"]],
d = function() private$.items[["d"]],
mea = function() private$.items[["mea"]],
item = function() private$.items[["item"]],
mat = function() private$.items[["mat"]],
itemd = function() private$.items[["itemd"]],
bmat = function() private$.items[["bmat"]],
bm = function() private$.items[["bm"]],
comp = function() private$.items[["comp"]],
plot1 = function() private$.items[["plot1"]],
text = function() private$.items[["text"]]),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Generalizability Theory",
refs="seolmatrix")
self$add(jmvcore::Html$new(
options=options,
name="instructions",
title="Instructions",
visible=TRUE))
self$add(jmvcore::Table$new(
options=options,
name="g",
title="Variance components of a single observation",
visible="(g)",
clearWith=list(
"dep",
"id",
"facet"),
refs="gtheory",
columns=list(
list(
`name`="name",
`title`="Source",
`type`="text",
`content`="($key)"),
list(
`name`="var",
`title`="variance",
`type`="number"),
list(
`name`="percent",
`title`="Percent",
`type`="number"),
list(
`name`="n",
`title`="n",
`type`="integer"))))
self$add(jmvcore::Table$new(
options=options,
name="gmea",
title="Measures of a single observation",
visible="(gmea)",
rows=1,
clearWith=list(
"dep",
"id",
"facet"),
refs="gtheory",
columns=list(
list(
`name`="name",
`title`="",
`type`="text",
`content`="D Study"),
list(
`name`="generalizability",
`title`="Generalizability",
`type`="number"),
list(
`name`="dependability",
`title`="Dependability",
`type`="number"),
list(
`name`="universe",
`title`="Universe score variance",
`type`="number"),
list(
`name`="relative",
`title`="Relative error variance",
`type`="number"),
list(
`name`="absolute",
`title`="Absolute error variance",
`type`="number"))))
self$add(jmvcore::Table$new(
options=options,
name="d",
title="Overall variance components",
visible="(d)",
clearWith=list(
"dep",
"id",
"facet"),
refs="gtheory",
columns=list(
list(
`name`="name",
`title`="Source",
`type`="text",
`content`="($key)"),
list(
`name`="var",
`title`="variance",
`type`="number"),
list(
`name`="percent",
`title`="Percent",
`type`="number"),
list(
`name`="n",
`title`="n",
`type`="integer"))))
self$add(jmvcore::Table$new(
options=options,
name="mea",
title="Overall Measures",
visible="(mea)",
rows=1,
clearWith=list(
"dep",
"id",
"facet"),
refs="gtheory",
columns=list(
list(
`name`="name",
`title`="",
`type`="text",
`content`="D Study"),
list(
`name`="generalizability",
`title`="Generalizability",
`type`="number"),
list(
`name`="dependability",
`title`="Dependability",
`type`="number"),
list(
`name`="universe",
`title`="Universe score variance",
`type`="number"),
list(
`name`="relative",
`title`="Relative error variance",
`type`="number"),
list(
`name`="absolute",
`title`="Absolute error variance",
`type`="number"))))
self$add(jmvcore::Array$new(
options=options,
name="item",
title="G Study: within variance components",
items="(ng)",
visible="(item)",
clearWith=list(
"dep",
"id",
"sub",
"facet",
"ng"),
template=jmvcore::Table$new(
options=options,
title="Variance components of strata($key)",
rows=3,
columns=list(
list(
`name`="source",
`title`="Source",
`type`="text"),
list(
`name`="var",
`title`="Variance",
`type`="number"),
list(
`name`="percent",
`title`="Percent",
`type`="number"),
list(
`name`="n",
`title`="n",
`type`="integer")))))
self$add(jmvcore::Table$new(
options=options,
name="mat",
title="Observed score variance and covariance between strata",
visible="(mat)",
clearWith=list(
"dep",
"id",
"sub",
"facet",
"ng"),
refs="gtheory",
columns=list(
list(
`name`="name",
`title`="",
`type`="text",
`content`="($key)"))))
self$add(jmvcore::Array$new(
options=options,
name="itemd",
title="D Study: within variance components",
items="(ng)",
visible="(itemd)",
clearWith=list(
"dep",
"id",
"sub",
"facet",
"ng"),
template=jmvcore::Table$new(
options=options,
title="Variance components of strata($key)",
rows=3,
columns=list(
list(
`name`="source",
`title`="Source",
`type`="text"),
list(
`name`="var",
`title`="Variance",
`type`="number"),
list(
`name`="percent",
`title`="Percent",
`type`="number"),
list(
`name`="n",
`title`="n",
`type`="integer")))))
self$add(jmvcore::Table$new(
options=options,
name="bmat",
title="Between universe score variance matrix",
visible="(bmat)",
clearWith=list(
"dep",
"id",
"sub",
"facet",
"ng"),
refs="gtheory",
columns=list(
list(
`name`="name",
`title`="",
`type`="text",
`content`="($key)"))))
self$add(jmvcore::Table$new(
options=options,
name="bm",
title="D Study: between measures",
visible="(bm)",
clearWith=list(
"dep",
"id",
"sub",
"facet",
"ng"),
refs="gtheory",
columns=list(
list(
`name`="name",
`title`="Subtest",
`type`="text",
`content`="($key)"),
list(
`name`="gen",
`title`="Generalizabilty",
`type`="number"),
list(
`name`="depe",
`title`="Dependability",
`type`="number"),
list(
`name`="rel",
`title`="Relative error variance",
`type`="number"),
list(
`name`="abs",
`title`="Absolute error variance",
`type`="number"))))
self$add(jmvcore::Table$new(
options=options,
name="comp",
title="D Study: composite measures",
visible="(comp)",
rows=1,
clearWith=list(
"dep",
"id",
"sub",
"facet",
"ng"),
refs="gtheory",
columns=list(
list(
`name`="name",
`title`="",
`type`="text",
`content`="D Study"),
list(
`name`="generalizability",
`title`="Generalizability",
`type`="number"),
list(
`name`="dependability",
`title`="Dependability",
`type`="number"),
list(
`name`="universe",
`title`="Universe score variance",
`type`="number"),
list(
`name`="relative",
`title`="Relative error variance",
`type`="number"),
list(
`name`="absolute",
`title`="Absolute error variance",
`type`="number"))))
self$add(jmvcore::Image$new(
options=options,
name="plot1",
title="D study for one facet design",
visible="(plot1)",
renderFun=".plot1",
requiresData=TRUE,
refs="seolmatrix",
clearWith=list(
"dep",
"id",
"facet",
"sub",
"nf",
"gco",
"width",
"height")))
self$add(jmvcore::Preformatted$new(
options=options,
name="text",
title="`Coefficient based on the number of facet(${nf})`",
visible="(plot1)",
refs="seolmatrix",
clearWith=list(
"dep",
"id",
"facet",
"sub",
"nf",
"gco")))}))
gtheoryBase <- if (requireNamespace("jmvcore", quietly=TRUE)) R6::R6Class(
"gtheoryBase",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = "seolmatrix",
name = "gtheory",
version = c(1,0,0),
options = options,
results = gtheoryResults$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE,
requiresMissings = FALSE,
weightsSupport = 'auto')
}))
#' Generalizability Theory
#'
#'
#' @param data .
#' @param dep .
#' @param id .
#' @param sub .
#' @param ng .
#' @param nf .
#' @param facet .
#' @param g .
#' @param d .
#' @param formula .
#' @param mea .
#' @param gmea .
#' @param item .
#' @param formula1 .
#' @param t .
#' @param itemd .
#' @param comp .
#' @param bm .
#' @param mat .
#' @param bmat .
#' @param plot1 .
#' @param width .
#' @param height .
#' @param gco .
#' @return A results object containing:
#' \tabular{llllll}{
#' \code{results$instructions} \tab \tab \tab \tab \tab a html \cr
#' \code{results$g} \tab \tab \tab \tab \tab a table \cr
#' \code{results$gmea} \tab \tab \tab \tab \tab a table \cr
#' \code{results$d} \tab \tab \tab \tab \tab a table \cr
#' \code{results$mea} \tab \tab \tab \tab \tab a table \cr
#' \code{results$item} \tab \tab \tab \tab \tab an array of tables \cr
#' \code{results$mat} \tab \tab \tab \tab \tab a table \cr
#' \code{results$itemd} \tab \tab \tab \tab \tab an array of tables \cr
#' \code{results$bmat} \tab \tab \tab \tab \tab a table \cr
#' \code{results$bm} \tab \tab \tab \tab \tab a table \cr
#' \code{results$comp} \tab \tab \tab \tab \tab a table \cr
#' \code{results$plot1} \tab \tab \tab \tab \tab an image \cr
#' \code{results$text} \tab \tab \tab \tab \tab a preformatted \cr
#' }
#'
#' Tables can be converted to data frames with \code{asDF} or \code{\link{as.data.frame}}. For example:
#'
#' \code{results$g$asDF}
#'
#' \code{as.data.frame(results$g)}
#'
#' @export
gtheory <- function(
data,
dep,
id,
sub,
ng = 2,
nf = 1,
facet,
g = FALSE,
d = FALSE,
formula = "value ~ (1 | subject) + (1 | task) + (1 | rater:task) + (1 | subject:task)",
mea = FALSE,
gmea = FALSE,
item = FALSE,
formula1 = "Score ~ (1 | Person) + (1 | Item)",
t = "uni",
itemd = FALSE,
comp = FALSE,
bm = FALSE,
mat = FALSE,
bmat = FALSE,
plot1 = FALSE,
width = 500,
height = 500,
gco = "TRUE") {
if ( ! requireNamespace("jmvcore", quietly=TRUE))
stop("gtheory requires jmvcore to be installed (restart may be required)")
if ( ! missing(dep)) dep <- jmvcore::resolveQuo(jmvcore::enquo(dep))
if ( ! missing(id)) id <- jmvcore::resolveQuo(jmvcore::enquo(id))
if ( ! missing(sub)) sub <- jmvcore::resolveQuo(jmvcore::enquo(sub))
if ( ! missing(facet)) facet <- jmvcore::resolveQuo(jmvcore::enquo(facet))
if (missing(data))
data <- jmvcore::marshalData(
parent.frame(),
`if`( ! missing(dep), dep, NULL),
`if`( ! missing(id), id, NULL),
`if`( ! missing(sub), sub, NULL),
`if`( ! missing(facet), facet, NULL))
for (v in id) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
for (v in sub) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
for (v in facet) if (v %in% names(data)) data[[v]] <- as.factor(data[[v]])
options <- gtheoryOptions$new(
dep = dep,
id = id,
sub = sub,
ng = ng,
nf = nf,
facet = facet,
g = g,
d = d,
formula = formula,
mea = mea,
gmea = gmea,
item = item,
formula1 = formula1,
t = t,
itemd = itemd,
comp = comp,
bm = bm,
mat = mat,
bmat = bmat,
plot1 = plot1,
width = width,
height = height,
gco = gco)
analysis <- gtheoryClass$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.