b_ttest {bayes4psy}R Documentation

b_ttest

Description

Bayesian t-test.

Usage

b_ttest(
  data,
  priors = NULL,
  warmup = 1000,
  iter = 2000,
  chains = 4,
  seed = NULL,
  refresh = NULL,
  control = NULL,
  suppress_warnings = TRUE
)

Arguments

data

Numeric vector of values on which the fit will be based.

priors

List of parameters and their priors - b_prior objects. You can put a prior on the mu (mean) and sigma (variance) parameters (default = NULL).

warmup

Integer specifying the number of warmup iterations per chain (default = 1000).

iter

Integer specifying the number of iterations (including warmup, default = 2000).

chains

Integer specifying the number of parallel chains (default = 4).

seed

Random number generator seed (default = NULL).

refresh

Frequency of output (default = NULL).

control

A named list of parameters to control the sampler's behavior (default = NULL).

suppress_warnings

Suppress warnings returned by Stan (default = TRUE).

Value

An object of class 'ttest_class'.

Examples


# priors
mu_prior <- b_prior(family="normal", pars=c(0, 1000))
sigma_prior <- b_prior(family="uniform", pars=c(0, 500))
nu_prior <- b_prior(family="normal", pars=c(2000, 1000))

# attach priors to relevant parameters
priors <- list(c("mu", mu_prior),
               c("sigma", sigma_prior),
               c("nu", nu_prior))

# generate some data
data  <- rnorm(20, mean=150, sd=20)

# fit
fit <- b_ttest(data=data, priors=priors, chains=1)



[Package bayes4psy version 1.2.12 Index]