# This file is automatically generated, you probably don't want to edit this
ttestPSOptions <- if (requireNamespace('jmvcore')) R6::R6Class(
"ttestPSOptions",
inherit = jmvcore::Options,
public = list(
initialize = function(
x = NULL,
y = NULL,
alternative = "two.sided",
mu = 0,
varEqual = FALSE,
confLevel = 0.95, ...) {
super$initialize(
package='jmvbaseR',
name='ttestPS',
requiresData=TRUE,
...)
private$..x <- jmvcore::OptionVariable$new(
"x",
x)
private$..y <- jmvcore::OptionVariable$new(
"y",
y)
private$..alternative <- jmvcore::OptionList$new(
"alternative",
alternative,
options=list(
"two.sided",
"less",
"greater"),
default="two.sided")
private$..mu <- jmvcore::OptionNumber$new(
"mu",
mu,
default=0)
private$..varEqual <- jmvcore::OptionBool$new(
"varEqual",
varEqual,
default=FALSE)
private$..confLevel <- jmvcore::OptionNumber$new(
"confLevel",
confLevel,
default=0.95)
self$.addOption(private$..x)
self$.addOption(private$..y)
self$.addOption(private$..alternative)
self$.addOption(private$..mu)
self$.addOption(private$..varEqual)
self$.addOption(private$..confLevel)
}),
active = list(
x = function() private$..x$value,
y = function() private$..y$value,
alternative = function() private$..alternative$value,
mu = function() private$..mu$value,
varEqual = function() private$..varEqual$value,
confLevel = function() private$..confLevel$value),
private = list(
..x = NA,
..y = NA,
..alternative = NA,
..mu = NA,
..varEqual = NA,
..confLevel = NA)
)
ttestPSResults <- if (requireNamespace('jmvcore')) R6::R6Class(
inherit = jmvcore::Group,
active = list(),
private = list(),
public=list(
initialize=function(options) {
super$initialize(
options=options,
name="",
title="Paired Samples T-Test")}))
ttestPSBase <- if (requireNamespace('jmvcore')) R6::R6Class(
"ttestPSBase",
inherit = jmvcore::Analysis,
public = list(
initialize = function(options, data=NULL, datasetId="", analysisId="", revision=0) {
super$initialize(
package = 'jmvbaseR',
name = 'ttestPS',
version = c(1,0,0),
options = options,
results = ttestPSResults$new(options=options),
data = data,
datasetId = datasetId,
analysisId = analysisId,
revision = revision,
pause = NULL,
completeWhenFilled = FALSE)
}))
#' Paired Samples T-Test
#'
#'
#' @param data the data as a data frame
#' @param x a string specifying the first measurement in \code{data}
#' @param y a string specifying the second measurement in \code{data}
#' @param alternative \code{'two.sided'}, \code{'less'}, or \code{'greater'}
#' @param mu a number, the mean of the null hypothesis
#' @param varEqual TRUE or FALSE (default), assume equal variances
#' @param confLevel a number between 0 and 1 (default: 0.95), specifying the
#' confidence interval width
#' @return A results object containing:
#' \tabular{llllll}{
#' }
#'
#' @export
ttestPS <- function(
data,
x,
y,
alternative = "two.sided",
mu = 0,
varEqual = FALSE,
confLevel = 0.95) {
if ( ! requireNamespace('jmvcore'))
stop('ttestPS requires jmvcore to be installed (restart may be required)')
options <- ttestPSOptions$new(
x = x,
y = y,
alternative = alternative,
mu = mu,
varEqual = varEqual,
confLevel = confLevel)
results <- ttestPSResults$new(
options = options)
analysis <- ttestPSClass$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.