center.test {familial}R Documentation

Center test

Description

Performs a one- or two-sample test for a family of centers.

Usage

center.test(
  x,
  y = NULL,
  family = "huber",
  alternative = c("two.sided", "less", "greater"),
  mu = 0,
  paired = FALSE,
  nboot = 1000,
  loss = NULL,
  cluster = NULL,
  ...
)

Arguments

x

a numeric vector of data

y

an optional numeric vector of data

family

the family of centers; currently only allows 'huber' for Huber family

alternative

the form of the alternative hypothesis; must be one of 'two.sided' (default), 'greater', or 'less'

mu

the null value of the center for a one-sample test, or the null value of the center of differences for a paired two-sample test, or the null value of the difference of centers for an independent two-sample test; can be an interval

paired

a logical indicating whether to treat x and y as paired

nboot

the number of bootstraps to perform

loss

an optional c×2 matrix of losses incurred from an incorrect decision, where c is the number of candidate choices (typically c=3: H0, H1, or indeterminate)

cluster

an optional cluster for running bootstraps in parallel; must be set up using parallel::makeCluster

...

any other arguments

Details

Uses the Bayesian bootstrap to compute posterior probabilities for the hypotheses \mathrm{H}_0:\mu(\lambda)=\mu_0 for some \lambda\in\Lambda vs. \mathrm{H}_1:\mu(\lambda)\neq\mu_0 for all \lambda\in\Lambda, where \{\mu(\lambda):\lambda\in\Lambda\} is a family of centers.
The default loss matrix results in a decision whenever the posterior probability for one of the hypotheses is greater than 0.95 and otherwise is indeterminate.

Value

An object of class center.test; a list with the following components:

expected.loss

the expected loss, calculated by post-multiplying loss with prob

decision

the optimal decision given the expected loss

loss

the loss matrix

prob

the estimated posterior probabilities of the null and alternative

boot

the bootstrap output from bayes.boot

x

the x that was supplied

y

the y that was supplied

mu

the mu that was supplied

family

the family that was supplied

Author(s)

Ryan Thompson <ryan.thompson1@unsw.edu.au>

References

Thompson, R., Forbes, C. S., MacEachern, S. N., and Peruggia, M. (2023). 'Familial inference: Tests for hypotheses on a family of centres'. arXiv: 2202.12540.

Examples

set.seed(123)

test <- center.test(MASS::galaxies, mu = 21000, nboot = 100)
print(test)
plot(test)

cl <- parallel::makeCluster(2)
test <- center.test(MASS::galaxies, mu = 21000, nboot = 100, cluster = cl)
parallel::stopCluster(cl)
print(test)

[Package familial version 1.0.5 Index]