apa_interval: Typeset Interval Estimate

View source: R/apa_interval.R

apa_intervalR Documentation

Typeset Interval Estimate

Description

Creates a character string to report interval estimates, such as frequentist confidence or Bayesian credible intervals.

Usage

apa_interval(x, ...)

print_interval(x, ...)

## S3 method for class 'numeric'
apa_interval(
  x,
  y = NULL,
  ...,
  conf.int = NULL,
  interval_type = NULL,
  enclose_math = FALSE
)

## S3 method for class 'matrix'
apa_interval(
  x,
  ...,
  conf.int = NULL,
  interval_type = NULL,
  enclose_math = FALSE
)

## S3 method for class 'data.frame'
apa_interval(
  x,
  ...,
  conf.int = NULL,
  interval_type = NULL,
  enclose_math = FALSE
)

## S3 method for class 'list'
apa_interval(
  x,
  ...,
  conf.int = NULL,
  interval_type = NULL,
  enclose_math = FALSE
)

apa_confint(
  x,
  ...,
  conf.int = NULL,
  interval_type = "CI",
  enclose_math = FALSE
)

print_confint(
  x,
  ...,
  conf.int = NULL,
  interval_type = "CI",
  enclose_math = FALSE
)

apa_hdint(x, ..., conf.int = NULL, interval_type = "HDI", enclose_math = FALSE)

print_hdint(
  x,
  ...,
  conf.int = NULL,
  interval_type = "HDI",
  enclose_math = FALSE
)

Arguments

x

Numeric. A vector (of length 2, unless y is also specified) with, a two-column matrix, or a data.frame, which can coerced to a matrix.

...

Further arguments passed on to apa_num().

y

Numeric. An optional vector of the same length as x.

conf.int

Numeric. Confidence level of the interval. Ignored if level can be inferred from attributes of x, see Details.

interval_type

Character. Abbreviation indicating the type of interval estimate, e.g. CI.

enclose_math

Logical. Indicates whether the interval should be enclosed in $ (i.e., a math environment).

Details

If possible the confidence level of the interval is inferred from attributes of x. For a vector of length 2, the attribute conf.level is is consulted; for a matrix or data.frame the column names are used, if they are of the format "2.5 \

If x is a matrix or data.frame the row names are used as names for the returned list of intervals.

Value

A single interval is returned as a character vector of length 1; multiple intervals are returned as a named list of character vectors of length 1.

See Also

apa_num()

Examples

apa_confint(1, 2, conf.int = 0.95)
apa_confint(c(1, 2), conf.int = 0.95)
apa_confint(matrix(c(1, 2), ncol = 2), conf.int = 0.95)
apa_confint(confint(lm(cars)))
apa_confint(confint(lm(cars)), digits = 3)

papaja documentation built on Oct. 30, 2024, 9:09 a.m.