chisqtest.ANSM {ANSM5}R Documentation

Perform Chi-squared test

Description

chisqtest.ANSM() is a wrapper for chisq.test() from the stats package - performs the Chi-squared test and is used in chapters 12 and 13 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

chisqtest.ANSM(
  x,
  y = NULL,
  p = NULL,
  cont.corr = TRUE,
  max.exact.cases = 10,
  nsims.mc = 1e+05,
  seed = NULL,
  do.exact = TRUE,
  do.asymp = FALSE,
  do.mc = FALSE
)

Arguments

x

Factor of same length as y, or table

y

Factor of same length as x (or NULL if x is table) (defaults to NULL)

p

Vector of probabilities (expressed as numbers between 0 and 1 and summing to 1) of same length as x or NULL (defaults to NULL)

cont.corr

Boolean indicating whether or not to use continuity correction (defaults to TRUE)

max.exact.cases

Maximum number of cases allowed for exact calculations (defaults to 10)

nsims.mc

Number of Monte Carlo simulations to be performed (defaults to 100000)

seed

Random number seed to be used for Monte Carlo simulations (defaults to NULL)

do.exact

Boolean indicating whether or not to perform exact calculations (defaults to TRUE)

do.asymp

Boolean indicating whether or not to perform asymptotic calculations (defaults to FALSE)

do.mc

Boolean indicating whether or not to perform Monte Carlo calculations (defaults to FALSE)

Value

An ANSMtest object with the results from applying the function

Examples

# Example 12.1 from "Applied Nonparametric Statistical Methods" (5th edition)
chisqtest.ANSM(ch12$feedback.freq, ch12$PPI.person, do.exact = FALSE, do.asymp = TRUE)

# Exercise 13.7 from "Applied Nonparametric Statistical Methods" (5th edition)
chisqtest.ANSM(ch13$medicine[ch13$location == "Rural"],
  ch13$response[ch13$location == "Rural"], seed = 1)


[Package ANSM5 version 1.1.0 Index]