Learn R Programming

ANSM5 (version 1.1.1)

lik.ratio: Perform Likelihood ratio test

Description

lik.ratio() performs the Likelihood ratio test and is used in chapters 12 and 13 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

lik.ratio(
  x,
  y,
  max.exact.cases = 10,
  nsims.mc = 1e+05,
  seed = NULL,
  do.exact = TRUE,
  do.asymp = FALSE,
  do.mc = FALSE
)

Value

An ANSMtest object with the results from applying the function

Arguments

x

Factor of same length as y

y

Factor of same length as x

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)

Examples

Run this code
# Example 12.2 from "Applied Nonparametric Statistical Methods" (5th edition)
lik.ratio(ch12$infection.site, ch12$district, do.exact = FALSE, do.asymp = TRUE)

# Example 13.12 from "Applied Nonparametric Statistical Methods" (5th edition)
chemo.side.effect.3 <- ch13$chemo.side.effect
levels(chemo.side.effect.3) <- list("Side-effect" = c("Hair loss",
  "Visual impairment", "Hair loss & Visual impairment"), "None" = "None")
lik.ratio(ch13$chemo.drug, chemo.side.effect.3, seed = 1)

Run the code above in your browser using DataLab