statsExpressions (version 0.3.1)

expr_t_onesample: Expression for one sample t-test and its non-parametric and robust equivalents

Description

Expression for one sample t-test and its non-parametric and robust equivalents

Usage

expr_t_onesample(
  data,
  x,
  type = "parametric",
  test.value = 0,
  bf.prior = 0.707,
  robust.estimator = "onestep",
  effsize.type = "g",
  effsize.noncentral = TRUE,
  conf.level = 0.95,
  conf.type = "norm",
  nboot = 100,
  k = 2,
  stat.title = NULL,
  messages = TRUE,
  ...
)

Arguments

data

A dataframe (or a tibble) from which variables specified are to be taken. A matrix or tables will not be accepted.

x

A numeric variable.

type

Type of statistic expected ("parametric" or "nonparametric" or "robust" or "bayes").Corresponding abbreviations are also accepted: "p" (for parametric), "np" (nonparametric), "r" (robust), or "bf"resp.

test.value

A number specifying the value of the null hypothesis (Default: 0).

bf.prior

A numeric value between 0.5 and 2 (default 0.707), the prior width to use in calculating Bayes Factors.

robust.estimator

If type = "robust", a robust estimator to be used ("onestep" (Default), "mom", or "median"). For more, see ?WRS2::onesampb.

effsize.type

Type of effect size needed for parametric tests. The argument can be "biased" ("d" for Cohen's d) or "unbiased" ("g" Hedge's g for t-test). The default is "g".

effsize.noncentral

Logical indicating whether to use non-central t-distributions for computing the confidence interval for Cohen's d or Hedge's g (Default: TRUE).

conf.level

Scalar between 0 and 1. If unspecified, the defaults return 95% lower and upper confidence intervals (0.95).

conf.type

A vector of character strings representing the type of intervals required. The value should be any subset of the values "norm", "basic", "perc", "bca". For more, see ?boot::boot.ci.

nboot

Number of bootstrap samples for computing confidence interval for the effect size (Default: 100).

k

Number of digits after decimal point (should be an integer) (Default: k = 2).

stat.title

A character describing the test being run, which will be added as a prefix in the subtitle. The default is NULL. An example of a stat.title argument will be something like "Student's t-test: ".

messages

Decides whether messages references, notes, and warnings are to be displayed (Default: TRUE).

...

Additional arguments (currently ignored).

Value

Expression containing results from a one-sample test. The exact test and the effect size details contained will be dependent on the type argument.

References

For more details, see- https://indrajeetpatil.github.io/statsExpressions/articles/stats_details.html

Examples

Run this code
# NOT RUN {
# for reproducibility
set.seed(123)

# ----------------------- parametric ---------------------------------------

statsExpressions::expr_t_onesample(
  data = ggplot2::msleep,
  x = brainwt,
  test.value = 0.275,
  type = "parametric"
)

# ----------------------- non-parametric -----------------------------------

statsExpressions::expr_t_onesample(
  data = ggplot2::msleep,
  x = brainwt,
  test.value = 0.275,
  type = "nonparametric"
)

# ----------------------- robust --------------------------------------------

statsExpressions::expr_t_onesample(
  data = ggplot2::msleep,
  x = brainwt,
  test.value = 0.275,
  type = "robust"
)

# ----------------------- Bayes Factor -----------------------------------

statsExpressions::expr_t_onesample(
  data = ggplot2::msleep,
  x = brainwt,
  test.value = 0.275,
  type = "bayes",
  bf.prior = 0.8
)
# }

Run the code above in your browser using DataLab