Package 'ANSM5'

Title: Functions and Data for the Book "Applied Nonparametric Statistical Methods", 5th Edition
Description: Functions and data to accompany the 5th edition of the book "Applied Nonparametric Statistical Methods" (4th edition: Sprent & Smeeton, 2024, ISBN:158488701X), the revisions from the 4th edition including a move from describing the output from a miscellany of statistical software packages to using R. While the output from many of the functions can also be obtained using a range of other R functions, this package provides functions in a unified setting and give output using both p-values and confidence intervals, exemplifying the book's approach of treating p-values as a guide to statistical importance and not an end product in their own right. Please note that in creating the ANSM5 package we do not claim to have produced software which is necessarily the most computationally efficient nor the most comprehensive.
Authors: Neil Spencer [aut, cre, cph]
Maintainer: Neil Spencer <[email protected]>
License: GPL (>= 3)
Version: 1.1.1
Built: 2025-01-31 05:24:29 UTC
Source: https://github.com/neilhspencer/ansm5

Help Index


Perform Ansari-Bradley test

Description

ansari.bradley() performs the Ansari-Bradley test and is used in chapter 6 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

ansari.bradley(
  x,
  y,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  max.exact.cases = 25,
  do.asymp = FALSE,
  do.exact = TRUE
)

Arguments

x

Numeric vector

y

Numeric vector

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

max.exact.cases

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

do.asymp

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

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 6.12 from "Applied Nonparametric Statistical Methods" (5th edition)
ansari.bradley(ch6$typeA, ch6$typeB)

# Exercise 6.16 from "Applied Nonparametric Statistical Methods" (5th edition)
ansari.bradley(ch6$travel, ch6$politics)

Data in Appendix 1

Description

Data in Appendix 1 of "Applied Nonparametric Statistical Methods" (5th edition)

  • McAlpha (used in example 4.5)

  • McBeta (used in example 6.6)

  • McGamma (used in exercise 4.1, example 6.6)

  • McDelta (used in examples 10.4, 10.8, exercise 10.5)

Usage

app1

Format

app1

A list with 4 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


Perform Binomial test

Description

binom() performs the Binomial test and calculates the Binomial confidence interval and is used in chapters 4, 5 and 13 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

binom(
  r,
  n,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  CI.width = 0.95,
  max.exact.cases = 1e+07,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.CI = TRUE
)

Arguments

r

Number of successes

n

Number of trials

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

CI.width

Confidence interval width (defaults to 0.95)

max.exact.cases

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

do.asymp

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

do.exact

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

do.CI

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 4.6 from "Applied Nonparametric Statistical Methods" (5th edition)
binom(3, 20)

# Exercise 5.8 from "Applied Nonparametric Statistical Methods" (5th edition)
binom(24, 40, 0.5)

Calculate Blomqvist coefficient

Description

blomqvist() calculates the Blomqvist coefficient and is used in chapter 10 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

blomqvist(
  x,
  y,
  alternative = c("two.sided", "less", "greater"),
  max.exact.cases = 1000,
  nsims.mc = 1e+05,
  seed = NULL,
  do.exact = TRUE,
  do.mc = FALSE
)

Arguments

x

Numeric vector of same length as y

y

Numeric vector of same length as x

alternative

Type of alternative hypothesis (defaults to two.sided)

max.exact.cases

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

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.mc

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

Value

An ANSMstat object with the results from applying the function

Examples

# Example 10.9 from "Applied Nonparametric Statistical Methods" (5th edition)
blomqvist(ch10$q1, ch10$q2, alternative = "greater")

# Exercise 10.7 from "Applied Nonparametric Statistical Methods" (5th edition)
blomqvist(ch10$ERA, ch10$SSS)

Perform Bowker's extension of McNemar's test

Description

bowker() performs the Bowker's extension of McNemar's test and is used in chapter 12 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

bowker(x, y = NULL, do.asymp = TRUE)

Arguments

x

Factor of same length as y, or two-dimensional square table

y

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

do.asymp

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 12.12 from "Applied Nonparametric Statistical Methods" (5th edition)
bowker(ch12$side.effect.new, ch12$side.effect.old)

# Exercise 12.12 from "Applied Nonparametric Statistical Methods" (5th edition)
bowker(ch12$first.response, ch12$second.response)

Perform Breslow and Day test

Description

breslow.day() performs the Breslow and Day test and is used in chapter 13 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

breslow.day(x, y, z, CI.width = 0.95, do.asymp = TRUE, do.CI = TRUE)

Arguments

x

Binary factor of same length as y, z

y

Binary factor of same length as x, z

z

Factor of same length as x, y

CI.width

Confidence interval width (defaults to 0.95)

do.asymp

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

do.CI

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 13.3 from "Applied Nonparametric Statistical Methods" (5th edition)
breslow.day(ch13$machine, ch13$output.status, ch13$material.source)

# Exercise 13.7 from "Applied Nonparametric Statistical Methods" (5th edition)
breslow.day(ch13$medicine, ch13$response, ch13$location)

Create bootstrap confidence interval

Description

bs() creates a bootstrap confidence interval and is used in chapter 14 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

bs(x, y = NULL, CI.width = 0.95, nsims.bs = 10000, seed = NULL)

Arguments

x

Numeric vector

y

Numeric vector or NULL (defaults to NULL)

CI.width

Confidence interval width (defaults to 0.95)

nsims.bs

Number of bootstrap samples to be taken (defaults to 10000)

seed

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

Value

A list object object with the results from applying the function

Examples

# Example 14.5 from "Applied Nonparametric Statistical Methods" (5th edition)
bs(ch14$example14.2, nsims.bs = 2000, CI.width = 0.95, seed = 1)
bs(ch14$example14.2, nsims.bs = 2000, CI.width = 0.99, seed = 1)

Data used in Chapter 10

Description

Data used in Chapter 10 of "Applied Nonparametric Statistical Methods" (5th edition)

  • q1 (used in section 10.1.2, examples 10.2, 10.5, 10.9)

  • q2 (used in section 10.1.2, examples 10.2, 10.5, 10.9)

  • death.year (used in examples 10.4, 10.8)

  • diving.rank (used in example 10.10)

  • competitors (used in example 10.10)

  • judges (used in example 10.10)

  • dentistA (used in example 10.11)

  • dentistB (used in example 10.11)

  • questionnaire (used in example 10.12, exercise 10.13)

  • demonstration (used in example 10.12, exercise 10.13)

  • gender (used in exercise 10.13)

  • items (used in example 10.12)

  • ERA (used in exercises 10.1, 10.3, 10.6, 10.7)

  • ESMS (used in exercises 10.1, 10.3, 10.6)

  • SSS (used in exercise 10.7)

  • British (used in example 10.8, exercise 10.10)

  • American (used in example 10.8, exercise 10.10)

  • Canadian (used in example 10.9, exercise 10.10)

  • Australian (used in example 10.9, exercise 10.10)

  • design (used in exercise 10.10)

  • country (used in exercise 10.10)

  • marks (used in exercise 10.11)

  • script (used in exercise 10.11)

  • examiner (used in exercise 10.11)

  • observerA (used in exercise 10.12)

  • observerB (used in exercise 10.12)

Usage

ch10

Format

ch10

A list with 26 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


Data used in Chapter 11

Description

Data used in Chapter 11 of "Applied Nonparametric Statistical Methods" (5th edition)

  • parentlimit (used in examples 11.2, 11.3, 11.4, 11.6)

  • reportedtime (used in examples 11.2, 11.3, 11.4, 11.6)

  • age (used in example 11.5)

  • length (used in example 11.5)

  • parentlimit.2 (used in example 11.7)

  • reportedtime.2 (used in example 11.7)

  • days.stored (used in exercise 11.3)

  • rotten (used in exercise 11.3)

  • ERA (used in exercise 11.6)

  • ESMS (used in exercise 11.6)

  • depth (used in exercise 11.8)

  • ammonia (used in exercise 11.8)

  • food.weight.A (used in exercise 11.9)

  • weight.gain.A (used in exercise 11.9)

  • food.weight.B (used in exercise 11.9)

  • weight.gain.B (used in exercise 11.9)

  • SW.England (used in exercise 11.10)

  • N.Scotland (used in exercise 11.10)

Usage

ch11

Format

ch11

A list with 18 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


Data used in Chapter 12

Description

Data used in Chapter 12 of "Applied Nonparametric Statistical Methods" (5th edition)

  • feedback.freq (used in example 12.1)

  • PPI.person (used in example 12.1)

  • infection.site (used in examples 12.2, 12.3)

  • district (used in examples 12.2, 12.3)

  • drugYZ (used in example 12.4)

  • side.effect (used in example 12.4)

  • drugAB (used in example 12.5)

  • side.effect.level (used in example 12.5)

  • time.to.failure (used in example 12.6)

  • cause (used in example 12.6)

  • dose (used in examples 12.7, 12.8)

  • dose.side.effect (used in example 12.7, 12.8)

  • platelet.count (used in examples 12.9)

  • spleen.size (used in example 12.9)

  • last.digits (used in example 12.10)

  • accidents (used in example 12.11)

  • accidents.reduced (used in example 12.11)

  • side.effect.new (used in example 12.12)

  • side.effect.old (used in example 12.12)

  • bronchitis (used in exercise 12.1)

  • otitis.media (used in exercise 12.1)

  • welsh.language (used in exercise 12.2)

  • opportunities (used in exercise 12.2)

  • diagnosis (used in exercise 12.3)

  • position.played (used in exercise 12.3)

  • PPI.person.2 (used in exercise 12.4)

  • feedback.satisfaction (used in exercise 12.4)

  • win.opinion (used in exercise 12.5)

  • supporter (used in exercise 12.5)

  • diabetes.status (used in exercise 12.6)

  • ethnic.group (used in exercise 12.6)

  • horse.wins (used in exercise 12.7)

  • F1.wins (used in exercise 12.8)

  • strokes (used in exercise 12.9)

  • recurrent.visits (used in exercise 12.10)

  • holes (used in exercise 12.11)

  • first.response (used in exercise 12.12)

  • second.response (used in exercise 12.12)

Usage

ch12

Format

ch12

A list with 38 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


Data used in Chapter 13

Description

Data used in Chapter 13 of "Applied Nonparametric Statistical Methods" (5th edition)

  • physical.activity (used in examples 13.1, 13.2, exercise 13.2)

  • tv.viewing (used in examples 13.1, 13.2, exercise 13.2)

  • gender (used in examples 13.1, 13.2, exercise 13.2)

  • machine (used in example 13.3)

  • output.status (used in example 13.3)

  • material.source (used in example 13.3)

  • drug (used in example 13.4, section 13.2.5)

  • side.effects (used in example 13.4, section 13.2.5)

  • age.group (used in example 13.4, section 13.2.5)

  • dose (used in examples 13.7, 13.8)

  • dose.side.effect (used in examples 13.7, 13.8)

  • alcohol (used in example 13.9)

  • malformation (used in example 13.9)

  • frequency (used in example 13.10)

  • person (used in example 13.10)

  • medicine (used in exercise 13.7, section 13.3.1)

  • response (used in exercise 13.7, section 13.3.1)

  • location (used in exercise 13.7, section 13.3.1)

  • chemo.drug (used in example 13.12)

  • chemo.side.effect (used in example 13.12)

  • group (used in section 13.4)

  • promoted (used in section 13.4)

  • company (used in section 13.4)

  • breakfast.eaten (used in exercise 13.3)

  • VEL (used in exercise 13.3)

  • boys.girls (used in exercise 13.3)

  • cholesterol (used in exercise 13.4)

  • SBP (used in exercise 13.4)

  • schooling (used in exercise 13.5)

  • abortion.attitude (used in exercise 13.5)

  • PPI.ages (used in exercise 13.9)

  • PPI.people (used in exercise 13.9)

  • laid.off (used in exercises 13.10, 13.11)

  • employee.ages (used in exercise 13.10)

  • employee.ages.2 (used in exercise 13.11)

Usage

ch13

Format

ch13

A list with 35 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


Data used in Chapter 14

Description

Data used in Chapter 14 of "Applied Nonparametric Statistical Methods" (5th edition)

  • example14.2 (used in examples 14.2, 14.5)

  • X14.4 (used in exercise 14.4)

  • Y14.4 (used in exercise 14.4)

Usage

ch14

Format

ch14

A list with 3 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


Data used in Chapter 15

Description

Data used in Chapter 15 of "Applied Nonparametric Statistical Methods" (5th edition)

  • diet (used in section 15.3.5)

  • BMI (used in section 15.3.1)

  • wgt.VLCD (used in section 15.3.2)

  • wgt.norm (used in section 15.3.2)

  • opdiff (used in section 15.3.5)

  • optime.VLCD (used in sections 15.3.3, 15.3.6)

  • optime.norm (used in sections 15.3.3, 15.3.6)

  • los.VLCD (used in section 15.3.6)

  • los.norm (used in section 15.3.6)

  • optime (used in section 15.3.4)

  • los (used in section 15.3.4)

Usage

ch15

Format

ch15

A list with 11 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


Data used in Chapter 3

Description

Data used in Chapter 3 of "Applied Nonparametric Statistical Methods" (5th edition)

  • sampleI (used in examples 3.1, 3.2, 3.3, exercise 3.17)

  • sampleII (used in examples 3.1, 3.2, 3.3, exercise 3.17)

  • heartrates1 (used in examples 3.4, 3.11)

  • heartrates2 (used in examples 3.5, 3.6, 3.7)

  • withties (used in example 3.8)

  • tiedifrounded1 (used in example 3.8)

  • tiedifrounded2 (used in example 3.8)

  • ages (used in example 3.8, exercise 3.9)

  • sampleA (used in example 3.12)

  • sampleB (used in examples 3.12, 3.13)

  • sampleA2 (used in example 3.12)

  • sampleA3 (used in example 3.12)

  • heartrates2a (used in example 3.14)

  • heartrates2b (used in example 3.14)

  • sampleIa (used in exercise 3.1)

  • parkingtime (used in exercise 3.3)

  • Svals (used in exercise 3.4)

  • children (used in exercise 3.6)

  • fishlengths (used in exercises 3.7, 3.11)

  • sleeptime (used in exercise 3.10)

  • weightloss (used in exercise 3.12)

  • plants (used in exercise 3.13)

  • birthprops (used in exercise 3.14)

  • assembly (used in exercise 3.15)

  • weightchange (used in exercise 3.16)

Usage

ch3

Format

ch3

A list with 25 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


Data used in Chapter 4

Description

Data used in Chapter 4 of "Applied Nonparametric Statistical Methods" (5th edition)

  • breaks (used in example 4.2)

  • ages (used in example 4.4)

  • precipitation (used in example 4.13)

  • tosses1 (used in example 4.14)

  • tosses2 (used in example 4.14)

  • tosses3 (used in example 4.14)

  • births (used in example 4.15)

  • times.as.degrees (used in example 4.16)

  • dates.as.degrees (used in example 4.17)

  • waiting.time (used in exercise 4.2)

  • visiting.supporters (used in exercise 4.3)

  • days.waiting (used in exercise 4.8)

  • rainfall.by.latitude (used in exercise 4.9)

  • points (used in exercise 4.10)

  • rainfall.DRC (used in exercise 4.11)

  • piped.water.DRC (used in exercise 4.12)

  • accident.bearings (used in exercise 4.13)

  • board.angles (used in exercise 4.14)

  • arrow.angles (used in exercise 4.15)

  • football.results (used in exercise 4.17)

Usage

ch4

Format

ch4

A list with 20 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


Data used in Chapter 5

Description

Data used in Chapter 5 of "Applied Nonparametric Statistical Methods" (5th edition)

  • LVF (used in example 5.1, exercise 6.2)

  • RVF (used in example 5.1, exercise 6.2)

  • arithmetic (used in example 5.2)

  • bp (used in example 5.3)

  • bp.incorrect (used in example 5.3)

  • yr0910 (used in example 5.10)

  • yr1314 (used in example 5.10)

  • bp.diff (used in exercise 5.1)

  • LabI (used in exercise 5.2)

  • LabII (used in exercise 5.2)

  • parent (used in exercise 5.4)

  • online (used in exercise 5.5)

  • lectures (used in exercise 5.5)

  • additiveA (used in exercise 5.9)

  • additiveB (used in exercise 5.9)

  • round2 (used in exercise 5.10)

  • round3 (used in exercise 5.10)

  • pollA (used in exercise 5.11)

  • pollB (used in exercise 5.11)

  • kHz0.125 (used in exercise 5.12)

  • kHz0.25 (used in exercise 5.12)

Usage

ch5

Format

ch5

A list with 21 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


Data used in Chapter 6

Description

Data used in Chapter 6 of "Applied Nonparametric Statistical Methods" (5th edition)

  • groupA (used in examples 6.1, 6.2, 6.3, 6.10, 6.17)

  • groupB (used in examples 6.1, 6.2, 6.3, 6.10, 6.17)

  • groupA.sch2 (used in example 6.4)

  • groupB.sch2 (used in example 6.4)

  • groupA.sch2.grp (used in example 6.5)

  • groupB.sch2.grp (used in example 6.5)

  • males (used in examples 6.7, 6.8)

  • females (used in examples 6.7, 6.8)

  • sampleI (used in example 6.9)

  • sampleII (used in example 6.9)

  • typeA (used in examples 6.11, 6.12, 6.13, exercises 6.11, 6.12)

  • typeB (used in examples 6.11, 6.12, 6.13, exercises 6.11, 6.12)

  • groupI (used in example 6.14)

  • groupII (used in example 6.14)

  • groupI.trimmed (used in example 6.14)

  • groupI.amended (used in example 6.14)

  • salivaF (used in examples 6.15, 6.16)

  • salivaM (used in examples 6.15, 6.16)

  • sex (used in example 6.18)

  • temp.H (used in exercise 6.1)

  • temp.L (used in exercise 6.1)

  • DMF.M (used in exercise 6.3)

  • DMF.F (used in exercise 6.3)

  • weight.diabetic (used in exercise 6.4)

  • weight.normal (used in exercise 6.4)

  • cooling.time.standard (used in exercise 6.5)

  • cooling.time.cheap (used in exercise 6.5)

  • wait.1979 (used in exercise 6.6)

  • wait.1983 (used in exercise 6.6)

  • activity.boys (used in exercise 6.7)

  • activity.girls (used in exercise 6.7)

  • time.withoutLD (used in exercises 6.13, 6.14)

  • time.withLD (used in exercises 6.13, 6.14)

  • doseI (used in exercise 6.15)

  • doseII (used in exercise 6.15)

  • doseI.2 (used in exercise 6.15)

  • travel (used in exercise 6.16)

  • politics (used in exercise 6.16)

  • twins (used in exercise 6.17)

Usage

ch6

Format

ch6

A list with 39 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


Data used in Chapter 7

Description

Data used in Chapter 7 of "Applied Nonparametric Statistical Methods" (5th edition)

  • affordability (used in example 7.1, exercise 7.16)

  • regions (used in example 7.1, exercise 7.16)

  • age (used in example 7.2)

  • positions (used in example 7.2)

  • dementia.age (used in examples 7.3, 7.9)

  • features (used in examples 7.3, 7.9)

  • time (used in examples 7.4, 7.5)

  • surgeon (used in examples 7.4, 7.5)

  • pulse (used in example 7.6)

  • student (used in example 7.6)

  • time.period (used in example 7.6)

  • nodes (used in example 7.7)

  • treatment (used in example 7.7)

  • block (used in example 7.7)

  • outcome (used in example 7.8)

  • member (used in example 7.8)

  • climb (used in example 7.8)

  • procedure.time (used in example 7.10)

  • team.member (used in example 7.10)

  • sentences (used in exercise 7.2)

  • author (used in exercise 7.2)

  • head.width (used in exercise 7.4)

  • species (used in exercise 7.4)

  • braking.distance (used in exercise 7.5)

  • speed (used in exercise 7.5)

  • platelet.count (used in exercise 7.6)

  • spleen.size (used in exercise 7.6)

  • liver.weight (used in exercise 7.7)

  • dose (used in exercise 7.7)

  • house (used in exercise 7.7)

  • mark (used in exercise 7.8)

  • scheme (used in exercise 7.8)

  • candidate (used in exercise 7.8)

  • prem.contractions (used in exercise 7.9)

  • drug (used in exercise 7.9)

  • patient (used in exercise 7.9)

  • births (used in exercise 7.11)

  • week (used in exercise 7.11)

  • weekday (used in exercise 7.11)

  • names.recalled (used in exercise 7.12)

  • group (used in exercise 7.12)

  • medical.student (used in exercise 7.12)

  • soc.media.use (used in exercise 7.14)

  • participant (used in exercise 7.14)

  • day (used in exercise 7.14)

  • braking.distance.2 (used in exercise 7.15)

  • initial.speed (used in exercise 7.15)

Usage

ch7

Format

ch7

A list with 47 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


Data used in Chapter 8

Description

Data used in Chapter 8 of "Applied Nonparametric Statistical Methods" (5th edition)

  • plant.weight (used in example 8.2)

  • growth.hormone (used in examples 8.6, 8.7)

  • undersoil.heating (used in examples 8.6, 8.7)

  • plant.weight.2 (used in example 8.6)

  • plant.weight.3 (used in examples 8.4, 8.5)

  • plant.weight.4 (used in example 8.7)

  • sequence (used in example 8.9)

  • periodI (used in example 8.9)

  • periodII (used in example 8.9)

  • sentences (used in example 8.10)

  • authors (used in example 8.10)

  • prey.preference (used in example 8.11)

  • prey (used in example 8.11)

  • larva (used in example 8.11)

  • game.time (used in exercise 8.3)

  • experience (used in exercise 8.3)

  • game (used in exercise 8.3)

  • periodI.mistakes.AB (used in exercise 8.6)

  • periodII.mistakes.AB (used in exercise 8.6)

  • periodI.mistakes.BA (used in exercise 8.6)

  • periodII.mistakes.BA (used in exercise 8.6)

  • periodI.time.AB (used in exercise 8.7)

  • periodII.time.AB (used in exercise 8.7)

  • periodI.time.BA (used in exercise 8.7)

  • periodII.time.BA (used in exercise 8.7)

  • seizure.score (used in exercises 8.8, 8.9)

  • hospital (used in exercises 8.8, 8.9)

  • silver.content (used in exercise 8.10)

  • dynasty (used in exercise 8.10)

Usage

ch8

Format

ch8

A list with 29 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


Data used in Chapter 9

Description

Data used in Chapter 9 of "Applied Nonparametric Statistical Methods" (5th edition)

  • symp.survtime (used in examples 9.1, 9.3)

  • symp.censor (used in examples 9.1, 9.3)

  • asymp.survtime (used in examples 9.1, 9.3)

  • asymp.censor (used in examples 9.1, 9.3)

  • sampleI.survtime (used in following example 9.3, example 9.4)

  • sampleI.censor (used in example 9.4)

  • sampleII.survtime (used in example 9.4)

  • sampleII.survtime.2 (used in following example 9.3)

  • sampleII.censor (used in example 9.4)

  • samplesAB.survtime (used in example 9.6)

  • samplesAB.censor (used in example 9.6)

  • samplesAB (used in example 9.6)

  • samplesXYZ.survtime (used in example 9.7)

  • samplesXYZ.censor (used in example 9.7)

  • samplesXYZ (used in example 9.7)

  • boys.toothtime (used in exercise 9.2)

  • girls.toothtime (used in exercise 9.2)

  • regimeA.survtime (used in exercises 9.5, 9.6)

  • regimeA.censor (used in exercises 9.5, 9.6)

  • regimeB.survtime (used in exercises 9.5, 9.6)

  • regimeB.censor (used in exercises 9.5, 9.6)

  • bulbA (used in exercise 9.8)

  • bulbB (used in exercise 9.8)

Usage

ch9

Format

ch9

A list with 23 data vectors

Source

"Applied Nonparametric Statistical Methods" (5th edition)


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)

Perform Cochran Q test

Description

cochran.q() performs the Cochran Q test and is used in chapter 7 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

cochran.q(
  y,
  groups,
  blocks,
  max.exact.perms = 1e+05,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE
)

Arguments

y

Binary vector of same length as groups, blocks

groups

Factor of same length as y, blocks with levels such that length(y) == nlevels(groups) * nlevels(blocks)

blocks

Factor of same length as y, groups with levels such that length(y) == nlevels(groups) * nlevels(blocks)

max.exact.perms

Maximum number of permutations allowed for exact calculations (defaults to 100000)

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.asymp

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

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 7.8 from "Applied Nonparametric Statistical Methods" (5th edition)
cochran.q(ch7$outcome, ch7$climb, ch7$member, do.exact = FALSE, do.asymp = TRUE)

# Exercise 7.14 from "Applied Nonparametric Statistical Methods" (5th edition)
cochran.q(ch7$soc.media.use, ch7$participant, ch7$day, do.exact = FALSE, do.asymp = TRUE)

Calculate Cohen's kappa

Description

cohen.kappa() calculates Cohen's kappa and is used in chapter 10 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

cohen.kappa(
  y1,
  y2,
  blocks = NULL,
  alternative = c("two.sided", "less", "greater"),
  CI.width = 0.95,
  max.exact.cases = 10,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.CI = FALSE,
  do.mc = FALSE
)

Arguments

y1

Factor of same length as y2, blocks and same levels as y2 and (if blocks not NULL) with 2 levels

y2

Factor of same length as y1, blocks and same levels as y1 and (if blocks not NULL) with 2 levels

blocks

Factor of same length as y1, y2 or NULL (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

CI.width

Confidence interval width (defaults to 0.95)

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.asymp

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

do.exact

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

do.CI

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

do.mc

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

Value

An ANSMstat object with the results from applying the function

Examples

# Example 10.11 from "Applied Nonparametric Statistical Methods" (5th edition)
cohen.kappa(ch10$dentistA, ch10$dentistB, do.asymp = TRUE, do.exact = FALSE,
  alternative = "greater")

# Example 10.12 from "Applied Nonparametric Statistical Methods" (5th edition)
cohen.kappa(ch10$questionnaire, ch10$demonstration, ch10$items)

Perform Conover test using standard or squared ranks

Description

conover() performs the Conover test using standard or squared ranks and is used in chapters 6 and 7 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

conover(
  x,
  y,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  abs.ranks = FALSE,
  max.exact.perms = 5e+06,
  nsims.mc = 10000,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.mc = FALSE
)

Arguments

x

Numeric vector of same length as y

y

Factor of same length as x

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

abs.ranks

Boolean indicating whether absolute ranks to be used instead of squared ranks (defaults to FALSE)

max.exact.perms

Maximum number of permutations allowed for exact calculations (defaults to 5000000)

nsims.mc

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

seed

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

do.asymp

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

do.exact

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

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 6.13 from "Applied Nonparametric Statistical Methods" (5th edition)
conover(ch6$typeA, ch6$typeB, do.exact = FALSE, do.asymp = TRUE)

# Exercise 7.15 from "Applied Nonparametric Statistical Methods" (5th edition)
conover(ch7$braking.distance.2, ch7$initial.speed, do.exact = FALSE, do.asymp = TRUE)

Perform Control median test

Description

control.median() performs the Control median test and is used in chapters 6 and 9 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

control.median(
  x,
  y,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  CI.width = 0.95,
  max.exact.cases = 1000,
  nsims.mc = 10000,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.CI = TRUE
)

Arguments

x

Numeric vector

y

Numeric vector

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

CI.width

Confidence interval width (defaults to 0.95)

max.exact.cases

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

nsims.mc

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

seed

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

do.asymp

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

do.exact

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

do.CI

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 6.9 from "Applied Nonparametric Statistical Methods" (5th edition)
control.median(ch6$sampleI, ch6$sampleII, alternative = "greater")

# Exercise 9.8 from "Applied Nonparametric Statistical Methods" (5th edition)
control.median(ch9$bulbA, ch9$bulbB, alternative = "greater", nsims = 1000)

Perform Cox-Stuart test

Description

cox.stuart() performs the Cox-Stuart test and is used in chapters 4 and 10 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

cox.stuart(
  x,
  alternative = c("two.sided", "less", "greater"),
  cont.corr = TRUE,
  max.exact.cases = 1e+07,
  do.asymp = FALSE,
  do.exact = TRUE
)

Arguments

x

Numeric vector

alternative

Type of alternative hypothesis (defaults to two.sided)

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 10000000)

do.asymp

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

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 4.13 from "Applied Nonparametric Statistical Methods" (5th edition)
cox.stuart(ch4$precipitation)

# Exercise 10.5 from "Applied Nonparametric Statistical Methods" (5th edition)
cox.stuart(app1$McDelta[order(ch10$death.year)], alternative = "less")

Perform Cramer-von Mises test

Description

cramer.von.mises() performs the Cramer-von Mises test and is used in chapter 6 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

cramer.von.mises(x, y, alternative = c("two.sided", "less", "greater"))

Arguments

x

Numeric vector

y

Numeric vector

alternative

Type of alternative hypothesis (defaults to two.sided)

Value

An ANSMtest object with the results from applying the function

Examples

# Example 6.16 from "Applied Nonparametric Statistical Methods" (5th edition)
cramer.von.mises(ch6$salivaF, ch6$salivaM)
cramer.von.mises(ch6$salivaF, ch6$salivaM, alternative = "greater")

Perform Fisher exact test

Description

fishertest.ANSM() is a wrapper for fisher.test() from the stats package - performs the Fisher exact test and is used in chapters 6, 12 and 13 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

fishertest.ANSM(
  x,
  y,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  max.exact.cases = 10000,
  do.exact = TRUE
)

Arguments

x

Numeric vector or factor

y

Numeric vector or factor

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

max.exact.cases

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

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 6.7 from "Applied Nonparametric Statistical Methods" (5th edition)
fishertest.ANSM(ch6$males, ch6$females)

# Exercise 13.10 from "Applied Nonparametric Statistical Methods" (5th edition)
fishertest.ANSM(ch13$laid.off, ch13$employee.ages)

Perform Friedman test

Description

friedman() performs the Friedman test and is used in chapter 7 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

friedman(
  y,
  groups,
  blocks,
  use.Iman.Davenport = FALSE,
  max.exact.perms = 1e+05,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE
)

Arguments

y

Numeric vector of same length as groups, blocks

groups

Factor of same length as y, blocks with levels such that length(y) == nlevels(groups) * nlevels(blocks)

blocks

Factor of same length as y, groups with levels such that length(y) == nlevels(groups) * nlevels(blocks)

use.Iman.Davenport

Boolean indicating whether or not to use Iman and Davenport approximation (defaults to FALSE)

max.exact.perms

Maximum number of permutations allowed for exact calculations (defaults to 100000)

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.asymp

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

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 7.6 from "Applied Nonparametric Statistical Methods" (5th edition)
friedman(ch7$pulse, ch7$time.period, ch7$student, do.exact = FALSE, do.asymp = TRUE)

# Exercise 7.12 from "Applied Nonparametric Statistical Methods" (5th edition)
friedman(ch7$names.recalled, ch7$group, ch7$medical.student, use.Iman.Davenport = TRUE,
  do.exact = FALSE, do.asymp = TRUE)

Perform Least Significant Differences test after the Friedman test

Description

friedman.lsd() performs the Least Significant Differences test after the Friedman test and is used in chapter 8 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

friedman.lsd(y, groups, blocks, ids)

Arguments

y

Numeric vector of same length as groups, blocks

groups

Factor of same length as y, blocks with levels such that length(y) == nlevels(groups) * nlevels(blocks)

blocks

Factor of same length as y, groups with levels such that length(y) == nlevels(groups) * nlevels(blocks)

ids

Vector of length 2 with elements both levels of groups

Value

An ANSMtest object with the results from applying the function

Examples

# Example 8.11 from "Applied Nonparametric Statistical Methods" (5th edition)
friedman.lsd(ch8$prey.preference, ch8$prey, ch8$larva, c("Cyclops", "Anopheles"))

#  from "Applied Nonparametric Statistical Methods" (5th edition)

Perform Gehan-Wilcoxon test

Description

gehan.wilcoxon() performs the Gehan-Wilcoxon test and is used in chapter 9 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

gehan.wilcoxon(
  x,
  y,
  x.c,
  y.c,
  alternative = c("two.sided", "less", "greater"),
  max.exact.perms = 1e+05,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE
)

Arguments

x

Numeric vector of same length as y, x.c, y.c

y

Numeric vector of same length as x, x.c, y.c

x.c

Binary vector of same length as x, y, x.c

y.c

Binary vector of same length as x, y, y.c

alternative

Type of alternative hypothesis (defaults to two.sided)

max.exact.perms

Maximum number of permutations allowed for exact calculations (defaults to 100000)

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.asymp

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

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 9.1 from "Applied Nonparametric Statistical Methods" (5th edition)
gehan.wilcoxon(ch9$symp.survtime, ch9$asymp.survtime,
  ch9$symp.censor, ch9$asymp.censor, alternative = "less",
  do.exact = FALSE, do.asymp = TRUE)

# Exercise 9.5 from "Applied Nonparametric Statistical Methods" (5th edition)
gehan.wilcoxon(ch9$regimeA.survtime, ch9$regimeB.survtime,
  ch9$regimeA.censor, ch9$regimeB.censor, do.exact = FALSE, do.asymp = TRUE)

Perform Hettmansperger and Elmore interaction test

Description

hettmansperger.elmore() performs the Hettmansperger and Elmore interaction test and is used in chapter 8 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

hettmansperger.elmore(
  y,
  factor.a,
  factor.b,
  nsims.mc = 1000,
  seed = NULL,
  do.asymp = TRUE,
  do.mc = FALSE,
  median.polish = FALSE
)

Arguments

y

Numeric vector of same length as factor.a, factor.b

factor.a

Factor of same length as y, factor.b

factor.b

Factor of same length as y, factor.a

nsims.mc

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

seed

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

do.asymp

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

do.mc

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

median.polish

Boolean indicating whether or not to use median polish (defaults to FALSE)

Value

An ANSMtest object with the results from applying the function

Examples

# Example 8.6 from "Applied Nonparametric Statistical Methods" (5th edition)
hettmansperger.elmore(ch8$plant.weight.2, ch8$growth.hormone, ch8$undersoil.heating)

# Exercise 8.3 from "Applied Nonparametric Statistical Methods" (5th edition)
hettmansperger.elmore(ch8$game.time, ch8$experience, ch8$game)

Perform Hodges-Ajne test

Description

hodges.ajne() performs the Hodges-Ajne test and is used in chapter 4 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

hodges.ajne(x, alternative = c("two.sided"), minx = 0, maxx = 360)

Arguments

x

Numeric vector

alternative

Type of alternative hypothesis (defaults to c("two.sided"))

minx

Minimum value for x (defaults to 0)

maxx

Maximum value for x (defaults to 360)

Value

An ANSMtest object with the results from applying the function

Examples

# Example 4.16 from "Applied Nonparametric Statistical Methods" (5th edition)
hodges.ajne(ch4$times.as.degrees)

# Exercise 4.14 from "Applied Nonparametric Statistical Methods" (5th edition)
hodges.ajne(ch4$board.angles)

Perform Jonckheere-Terpstra test

Description

jonckheere.terpstra() performs the Jonckheere-Terpstra test and is used in chapters 7, 8 and 12 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

jonckheere.terpstra(
  x,
  g,
  alternative = c("less", "greater"),
  max.exact.cases = 15,
  nsims.mc = 10000,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.mc = FALSE,
  do.asymp.ties.adjust = TRUE
)

Arguments

x

Numeric vector or factor of same length as g

g

Factor of same length as x

alternative

Type of alternative hypothesis (defaults to c("less","greater"))

max.exact.cases

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

nsims.mc

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

seed

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

do.asymp

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

do.exact

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

do.mc

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

do.asymp.ties.adjust

Boolean indicating whether or not to use adjustment for ties in data (defaults to TRUE)

Value

An ANSMtest object with the results from applying the function

Examples

# Example 7.3 from "Applied Nonparametric Statistical Methods" (5th edition)
jonckheere.terpstra(ch7$dementia.age, ch7$features, alternative = "greater",
  do.exact = FALSE, do.asymp = TRUE, do.asymp.ties.adjust = FALSE)

# Exercise 12.6 from "Applied Nonparametric Statistical Methods" (5th edition)
jonckheere.terpstra(ch12$ethnic.group, ch12$diabetes.status, do.exact = FALSE, do.asymp = TRUE)

Calculate Kendall's concordance

Description

kendall.concordance() calculates Kendall's concordance and is used in chapter 10 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

kendall.concordance(
  y,
  groups,
  blocks,
  max.exact.perms = 1e+05,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE
)

Arguments

y

Numeric vector of same length as groups, blocks

groups

Factor of same length as y, blocks with levels such that length(y) == nlevels(groups) * nlevels(blocks)

blocks

Factor of same length as y, groups with levels such that length(y) == nlevels(groups) * nlevels(blocks)

max.exact.perms

Maximum number of permutations allowed for exact calculations (defaults to 100000)

nsims.mc

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

seed

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

do.asymp

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

do.exact

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

Value

An ANSMstat object with the results from applying the function

Examples

# Exercise 10.11 from "Applied Nonparametric Statistical Methods" (5th edition)
kendall.concordance(ch10$marks, ch10$script, ch10$examiner, do.exact = FALSE, do.asymp = TRUE)
kendall.concordance(ch10$marks, ch10$examiner, ch10$script, do.exact = FALSE, do.asymp = TRUE)

Perform Kendall's tau

Description

kendall.tau() performs the Kendall's tau and is used in chapter 10 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

kendall.tau(
  x,
  y,
  alternative = c("two.sided", "less", "greater"),
  max.exact.cases = 10,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.mc = FALSE
)

Arguments

x

Numeric vector of same length as y

y

Numeric vector of same length as x

alternative

Type of alternative hypothesis (defaults to two.sided)

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.asymp

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

do.exact

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

do.mc

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

Value

An ANSMstat object with the results from applying the function

Examples

# Example 10.8 from "Applied Nonparametric Statistical Methods" (5th edition)
kendall.tau(ch10$death.year, app1$McDelta, alternative = "greater",
  do.asymp = TRUE, do.exact = FALSE)

# Example 10.9 from "Applied Nonparametric Statistical Methods" (5th edition)
kendall.tau(ch10$Canadian, ch10$Australian)

Perform Kruskal-Wallis test

Description

kruskal.wallis() performs the Kruskal-Wallis test and is used in chapters 7 and 12 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

kruskal.wallis(
  x,
  g,
  max.exact.cases = 15,
  nsims.mc = 10000,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.mc = FALSE
)

Arguments

x

Numeric vector or factor of same length as g

g

Factor of same length as x

max.exact.cases

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

nsims.mc

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

seed

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

do.asymp

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

do.exact

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

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 7.1 from "Applied Nonparametric Statistical Methods" (5th edition)
kruskal.wallis(ch7$affordability, ch7$regions, do.exact = FALSE, do.asymp = TRUE)

# Exercise 7.16 from "Applied Nonparametric Statistical Methods" (5th edition)
kruskal.wallis(ch7$affordability, ch7$regions)

Perform Least Significant Differences test after the Kruskal-Wallis test

Description

kruskal.wallis.lsd() performs the Least Significant Differences test after the Kruskal-Wallis test and is used in chapter 8 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

kruskal.wallis.lsd(x, g, ids)

Arguments

x

Numeric vector of same length as g

g

Factor of same length as x

ids

Vector of length 2 with elements both levels of g

Value

An ANSMtest object with the results from applying the function

Examples

# Example 8.10 from "Applied Nonparametric Statistical Methods" (5th edition)
kruskal.wallis.lsd(ch8$sentences, ch8$authors, c("Vulliamy", "Queen"))

# Exercise 8.8 from "Applied Nonparametric Statistical Methods" (5th edition)
kruskal.wallis.lsd(ch8$seizure.score, ch8$hospital, c("HospitalA", "HospitalC"))

Perform Kruskal-Wallis test with van der Waerden scores

Description

kruskal.wallis.vdW() performs the Kruskal-Wallis test with van der Waerden scores and is used in chapter 7 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

kruskal.wallis.vdW(
  x,
  g,
  max.exact.cases = 15,
  nsims.mc = 10000,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE
)

Arguments

x

Numeric vector of same length as g

g

Factor of same length as x

max.exact.cases

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

nsims.mc

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

seed

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

do.asymp

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

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 7.2 from "Applied Nonparametric Statistical Methods" (5th edition)
kruskal.wallis.vdW(ch7$age, ch7$positions)
kruskal.wallis.vdW(ch7$age, ch7$positions, do.exact = FALSE, do.asymp = TRUE)

Perform Smirnov test and Kolgomorov test

Description

kstest.ANSM() is a wrapper for ks.test() from the stats package - performs the Smirnov test and Kolgomorov test and is used in chapters 4, 6 and 9 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

kstest.ANSM(
  x,
  y,
  ...,
  alternative = c("two.sided", "less", "greater"),
  max.exact.cases = 1000,
  do.asymp = FALSE,
  do.exact = TRUE
)

Arguments

x

Numeric vector

y

Numeric vector or a character string naming a cumulative distribution function or an actual cumulative distribution function

...

For the default method of ks.test, parameters of the distribution specified (as a character string) by y. Otherwise, further arguments to be passed to or from methods

alternative

Type of alternative hypothesis (defaults to two.sided)

max.exact.cases

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

do.asymp

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

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Exercise 4.3 from "Applied Nonparametric Statistical Methods" (5th edition)
kstest.ANSM(ch4$visiting.supporters, "pexp", rate = 2600)

# Exercise 9.2 from "Applied Nonparametric Statistical Methods" (5th edition)
kstest.ANSM(ch9$boys.toothtime, ch9$girls.toothtime)

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
)

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)

Value

An ANSMtest object with the results from applying the function

Examples

# 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)

Performs Lilliefors test of Normality

Description

lilliefors() performs Lilliefors test of Normality and is used in chapters 4, 5 and 6 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

lilliefors(x, alternative = c("two.sided"), nsims.mc = 10000, seed = NULL)

Arguments

x

Numeric vector

alternative

Type of alternative hypothesis (defaults to c("two.sided"))

nsims.mc

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

seed

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 4.4 from "Applied Nonparametric Statistical Methods" (5th edition)
lilliefors(ch4$ages, seed = 1)

# Exercise 6.15 from "Applied Nonparametric Statistical Methods" (5th edition)
lilliefors(ch6$doseI.2, seed = 1, nsims = 1000)

Perform Linear by linear association test

Description

linear.by.linear() performs the Linear by linear association test and is used in chapter 13 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

linear.by.linear(
  x,
  y,
  u = NULL,
  v = NULL,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.mc = TRUE
)

Arguments

x

Factor of same length as y

y

Factor of same length as x

u

Numeric vector of length equal to number of levels of x or NULL (defaults to NULL)

v

Numeric vector of length equal to number of levels of y or NULL (defaults to NULL)

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.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 TRUE)

Value

An ANSMtest object with the results from applying the function

Examples

# Example 13.8 from "Applied Nonparametric Statistical Methods" (5th edition)
linear.by.linear(ch13$dose, ch13$dose.side.effect, do.mc = FALSE, do.asymp = TRUE)

# Exercise 13.4 from "Applied Nonparametric Statistical Methods" (5th edition)
linear.by.linear(ch13$SBP, ch13$cholesterol, seed = 1)

Perform Log odds ratio test

Description

logoddsratio.2x2() performs the Log odds ratio test and is used in chapter 13 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

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

Arguments

x

Binary factor of same length as y

y

Binary 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)

Value

An ANSMtest object with the results from applying the function

Examples

# Exercise 13.2 from "Applied Nonparametric Statistical Methods" (5th edition)
#logoddsratio.2x2(ch13$physical.activity[ch13$gender == "Boy"],
#  ch13$tv.viewing[ch13$gender == "Boy"], do.exact = FALSE, do.asymp = TRUE)
#logoddsratio.2x2(ch13$physical.activity[ch13$gender == "Girl"],
#  ch13$tv.viewing[ch13$gender == "Girl"], do.exact = FALSE, do.asymp = TRUE)

Perform logrank test

Description

logrank() performs the logrank test and is used in chapter 9 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

logrank(
  x,
  censored,
  groups,
  score.censored = TRUE,
  max.exact.perms = 1e+05,
  nsims.mc = 10000,
  seed = NULL
)

Arguments

x

Numeric vector of same length as censored, groups

censored

Binary vector of same length as x, groups

groups

Factor of same length as x, censored

score.censored

Boolean indicating whether or not to score censored values (defaults to TRUE)

max.exact.perms

Maximum number of permutations allowed for exact calculations (defaults to 100000)

nsims.mc

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

seed

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 9.6 from "Applied Nonparametric Statistical Methods" (5th edition)
logrank(ch9$samplesAB.survtime, ch9$samplesAB.censor, ch9$samplesAB, score.censored = FALSE)

# Exercise 9.7 from "Applied Nonparametric Statistical Methods" (5th edition)
logrank(ch9$samplesXYZ.survtime, ch9$samplesXYZ.censor, ch9$samplesXYZ)

Perform Mantel-Haenszel test

Description

mantel.haenszel() performs the Mantel-Haenszel test and is used in chapter 13 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

mantel.haenszel(x, y, z, do.asymp = TRUE)

Arguments

x

Binary factor of same length as y, z

y

Binary factor of same length as x, z

z

Factor of same length as x, y

do.asymp

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 13.4 from "Applied Nonparametric Statistical Methods" (5th edition)
mantel.haenszel(ch13$drug, ch13$side.effects, ch13$age.group)

#  from "Applied Nonparametric Statistical Methods" (5th edition)

Perform Median test

Description

med.test() performs the Median test and is used in chapters 6 and 7 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

med.test(
  x,
  y,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  CI.width = 0.95,
  max.exact.cases = 1000,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.CI = TRUE
)

Arguments

x

Numeric vector of same length as y

y

Numeric vector, or factor of same length as x

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

CI.width

Confidence interval width (defaults to 0.95)

max.exact.cases

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

do.asymp

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

do.exact

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

do.CI

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 6.7 from "Applied Nonparametric Statistical Methods" (5th edition)
med.test(ch6$males, ch6$females)

# Example 7.5 from "Applied Nonparametric Statistical Methods" (5th edition)
med.test(ch7$time, ch7$surgeon, do.exact = FALSE, do.asymp = TRUE)

Perform Mood test

Description

mood() performs the Mood test and is used in chapter 6 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

mood(
  x,
  y,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  max.exact.cases = 25,
  do.asymp = FALSE,
  do.exact = TRUE
)

Arguments

x

Numeric vector

y

Numeric vector

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

max.exact.cases

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

do.asymp

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

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 6.12 from "Applied Nonparametric Statistical Methods" (5th edition)
mood(ch6$typeA, ch6$typeB)
mood(ch6$typeA, ch6$typeB, do.exact = FALSE, do.asymp = TRUE)

Perform Moses test for extreme reactions

Description

moses.extreme.reactions() performs the Moses test for extreme reactions and is used in chapter 6 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

moses.extreme.reactions(
  x,
  y,
  H0 = NULL,
  max.exact.cases = 1000,
  do.exact = TRUE
)

Arguments

x

Numeric vector

y

Numeric vector

H0

Null hypothesis value (defaults to NULL)

max.exact.cases

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

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 6.14 from "Applied Nonparametric Statistical Methods" (5th edition)
moses.extreme.reactions(ch6$groupI.amended, ch6$groupII)
moses.extreme.reactions(ch6$groupI.amended, ch6$groupII)

Calculate Noether approximation

Description

noether() calculates the Noether approximation and is used in chapter 5 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

noether(p1, alpha = 0.05, power = 0.9)

Arguments

p1

Probability (expressed as a number between 0 and 1)

alpha

Level of significance (expressed as number between 0 and 1) (defaults to 0.05)

power

Power (expressed as number between 0 and 1) (defaults to 0.9)

Value

An ANSMtest object with the results from applying the function

Examples

# Exercise 5.8 from "Applied Nonparametric Statistical Methods" (5th edition)
noether(p1 = 0.7534, alpha = 0.05, power = 0.9)

# Exercise 5.16 from "Applied Nonparametric Statistical Methods" (5th edition)
noether(p1 = 0.8, alpha = 0.025, power = 0.9)

Perform Normal Scores test

Description

normal.scores.test() performs the Normal Scores test and is used in chapters 6 and 8 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

normal.scores.test(
  x,
  y,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  max.exact.cases = 25,
  do.asymp = FALSE,
  do.exact = TRUE
)

Arguments

x

Numeric vector

y

Numeric vector

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

max.exact.cases

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

do.asymp

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

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 5.8 from "Applied Nonparametric Statistical Methods" (5th edition)
normal.scores.test(ch6$groupA, ch6$groupB, do.exact = FALSE, do.asymp = TRUE)

# Exercise 6.15 from "Applied Nonparametric Statistical Methods" (5th edition)
normal.scores.test(ch6$doseI, ch6$doseII)

Perform test for difference in odds ratios

Description

oddsratio.2x2diff() performs the test for difference in odds ratios and is used in chapter 13 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

oddsratio.2x2diff(
  x,
  y,
  z,
  alternative = c("two.sided", "less", "greater"),
  CI.width = 0.95,
  max.exact.perms = 1e+06,
  nsims.mc = 1e+05,
  seed = NULL,
  do.exact = TRUE,
  do.asymp = FALSE,
  do.mc = FALSE,
  do.CI = TRUE
)

Arguments

x

Binary factor of same length as y, z

y

Binary factor of same length as x, z

z

Binary factor of same length as x, y

alternative

Type of alternative hypothesis (defaults to two.sided)

CI.width

Confidence interval width (defaults to 0.95)

max.exact.perms

Maximum number of permutations allowed for exact calculations (defaults to 1000000)

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)

do.CI

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 13.2 from "Applied Nonparametric Statistical Methods" (5th edition)
oddsratio.2x2diff(ch13$physical.activity, ch13$tv.viewing, ch13$gender,
  do.exact = FALSE, do.asymp = TRUE)
oddsratio.2x2diff(ch13$physical.activity, ch13$tv.viewing, ch13$gender,
  do.exact = FALSE, do.mc = TRUE, seed = 1, nsims = 10000)

Calculate Pearson correlation

Description

pearson() calculates the Pearson correlation and is used in chapters 10 and 11 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

pearson(
  x,
  y,
  alternative = c("two.sided", "less", "greater"),
  max.exact.cases = 10,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.mc = FALSE
)

Arguments

x

Numeric vector of same length as y

y

Numeric vector of same length as x

alternative

Type of alternative hypothesis (defaults to two.sided)

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.asymp

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

do.exact

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

do.mc

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

Value

An ANSMstat object with the results from applying the function

Examples

# Section 10.1.2 from "Applied Nonparametric Statistical Methods" (5th edition)
pearson(ch10$q1, ch10$q2, alternative = "greater", do.asymp = TRUE, do.exact = FALSE)

# Example 11.2 from "Applied Nonparametric Statistical Methods" (5th edition)
pearson(ch11$parentlimit, ch11$reportedtime - 1 * ch11$parentlimit, alternative = "two.sided")

Calculate Pearson beta

Description

pearson.beta() calculates the Pearson beta and is used in chapter 11 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

pearson.beta(
  y,
  x,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  CI.width = 0.95,
  max.exact.cases = 10,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.CI = FALSE,
  do.mc = FALSE
)

Arguments

y

Numeric vector of same length as x

x

Numeric vector of same length as y

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

CI.width

Confidence interval width (defaults to 0.95)

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.asymp

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

do.exact

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

do.CI

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

do.mc

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

Value

An ANSMstat object with the results from applying the function

Examples

# Example 11.2 from "Applied Nonparametric Statistical Methods" (5th edition)
pearson.beta(ch11$reportedtime, ch11$parentlimit, H0 = 1)
pearson.beta(ch11$reportedtime[1:6], ch11$parentlimit[1:6], H0 = 1)

Perform Peto-Wilcoxon test

Description

peto.wilcoxon() performs the Peto-Wilcoxon test and is used in chapter 9 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

peto.wilcoxon(
  x,
  y,
  x.c,
  y.c,
  alternative = c("two.sided", "less", "greater"),
  max.exact.perms = 1e+05,
  nsims.mc = 10000,
  seed = NULL
)

Arguments

x

Numeric vector of same length as y, x.c, y.c

y

Numeric vector of same length as x, x.c, y.c

x.c

Binary vector of same length as x, y, x.c

y.c

Binary vector of same length as x, y, y.c

alternative

Type of alternative hypothesis (defaults to two.sided)

max.exact.perms

Maximum number of permutations allowed for exact calculations (defaults to 100000)

nsims.mc

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

seed

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 9.4 from "Applied Nonparametric Statistical Methods" (5th edition)
peto.wilcoxon(ch9$sampleI.survtime, ch9$sampleII.survtime,
  ch9$sampleI.censor, ch9$sampleII.censor, alternative = "less")

Perform Pitman test

Description

pitman() performs the Pitman test and is used in chapter 3 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

pitman(
  x,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  CI.width = 0.95,
  max.exact.cases = 1000,
  nsims.mc = 10000,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.CI = TRUE
)

Arguments

x

Numeric vector

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

CI.width

Confidence interval width (defaults to 0.95)

max.exact.cases

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

nsims.mc

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

seed

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

do.asymp

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

do.exact

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

do.CI

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 3.11 from "Applied Nonparametric Statistical Methods" (5th edition)
pitman(ch3$heartrates1, 70, "greater", do.exact = FALSE, do.asymp = TRUE)

# Exercise 3.17 from "Applied Nonparametric Statistical Methods" (5th edition)
pitman(ch3$sampleII, 110, do.exact = FALSE, do.asymp = TRUE)

Prints an ANSMstat object

Description

print.ANSMstat() prints the output contained in an ANSMstat object

Usage

## S3 method for class 'ANSMstat'
print(x, ...)

Arguments

x

An ANSMstat object

...

Further arguments relevant to the default print function

Value

No return value, called to display results


Prints an ANSMtest object

Description

print.ANSMtest() prints the output contained in an ANSMtest object

Usage

## S3 method for class 'ANSMtest'
print(x, ...)

Arguments

x

An ANSMtest object

...

Further arguments relevant to the default print function

Value

No return value, called to display results


Perform Range test

Description

rng.test() performs the Range test and is used in chapter 4 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

rng.test(x, alternative = c("two.sided"), minx = 0, maxx = 360)

Arguments

x

Numeric vector

alternative

Type of alternative hypothesis (defaults to c("two.sided"))

minx

Minimum value for x (defaults to 0)

maxx

Maximum value for x (defaults to 360)

Value

An ANSMtest object with the results from applying the function

Examples

# Example 4.17 from "Applied Nonparametric Statistical Methods" (5th edition)
rng.test(ch4$dates.as.degrees)

# Exercise 4.13 from "Applied Nonparametric Statistical Methods" (5th edition)
rng.test(ch4$accident.bearings)

Perform Runs test for two categories

Description

runs.2cat() performs the Runs test for two categories and is used in chapters 4, 5 and 6 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

runs.2cat(
  x,
  alternative = c("two.sided", "less", "greater"),
  cont.corr = TRUE,
  do.asymp = FALSE,
  do.exact = TRUE
)

Arguments

x

Vector with two unique values

alternative

Type of alternative hypothesis (defaults to two.sided)

cont.corr

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

do.asymp

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

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 4.14 from "Applied Nonparametric Statistical Methods" (5th edition)
runs.2cat(ch4$tosses1, do.exact = FALSE, do.asymp = TRUE)

# Exercise 6.17 from "Applied Nonparametric Statistical Methods" (5th edition)
runs.2cat(ch6$twins, alternative = "greater")

Perform Runs test for three or more categories

Description

runs.ncat() performs the Runs test for three or more categories and is used in chapters 4 and 7 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

runs.ncat(
  x,
  alternative = c("two.sided", "less", "greater"),
  cont.corr = TRUE,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = TRUE,
  do.mc = FALSE
)

Arguments

x

Vector or factor

alternative

Type of alternative hypothesis (defaults to two.sided)

cont.corr

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

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.asymp

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

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 4.15 from "Applied Nonparametric Statistical Methods" (5th edition)
runs.ncat(ch4$births, alternative = "less")

# Exercise 7.16 from "Applied Nonparametric Statistical Methods" (5th edition)
runs.ncat(ch7$regions[order(ch7$affordability)], alternative = "less")

Perform Sign test

Description

sgn.test() performs the Sign test and is used in chapters 3, 4, 5 and 6 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

sgn.test(
  x,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  cont.corr = TRUE,
  CI.width = 0.95,
  max.exact.cases = 1e+06,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.CI = TRUE
)

Arguments

x

Numeric vector, or binary factor and H0 is NULL

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

cont.corr

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

CI.width

Confidence interval width (defaults to 0.95)

max.exact.cases

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

do.asymp

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

do.exact

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

do.CI

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 3.1 from "Applied Nonparametric Statistical Methods" (5th edition)
sgn.test(ch3$sampleI, 110)

# Exercise 6.2 from "Applied Nonparametric Statistical Methods" (5th edition)
sgn.test(ch5$LVF - ch5$RVF, 0)

Perform Shapiro-Wilk test of Normality

Description

shapirotest.ANSM() is a wrapper for shapiro.test() from the stats package - performs the Shapiro-Wilk test of Normality and is used in chapters 4 and 5 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

shapirotest.ANSM(x, alternative = c("two.sided"))

Arguments

x

Numeric vector

alternative

Type of alternative hypothesis (defaults to c("two.sided"))

Value

An ANSMtest object with the results from applying the function

Examples

# Example 4.4 from "Applied Nonparametric Statistical Methods" (5th edition)
shapirotest.ANSM(ch4$ages)

# Example 5.3 from "Applied Nonparametric Statistical Methods" (5th edition)
shapirotest.ANSM(ch5$bp.incorrect)

Perform Siegel-Tukey test

Description

siegel.tukey() performs the Siegel-Tukey test using mean or median shift and is used in chapter 6 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

siegel.tukey(
  x,
  y,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  mean.shift = FALSE,
  cont.corr = TRUE,
  max.exact.cases = 1000,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE
)

Arguments

x

Numeric vector

y

Numeric vector

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

mean.shift

Boolean indicating whether mean shift to be used instead of median shift (defaults to FALSE)

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 1000)

seed

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

do.asymp

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

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Exercise 6.11 from "Applied Nonparametric Statistical Methods" (5th edition)
siegel.tukey(ch6$typeA, ch6$typeB, mean.shift = TRUE)

# Exercise 6.16 from "Applied Nonparametric Statistical Methods" (5th edition)
siegel.tukey(ch6$travel, ch6$politics)

Calculate Spearman correlation

Description

spearman() calculates the Spearman correlation and is used in chapter 10 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

spearman(
  x,
  y,
  alternative = c("two.sided", "less", "greater"),
  max.exact.cases = 10,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.mc = FALSE
)

Arguments

x

Numeric vector of same length as y

y

Numeric vector of same length as x

alternative

Type of alternative hypothesis (defaults to two.sided)

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.asymp

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

do.exact

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

do.mc

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

Value

An ANSMstat object with the results from applying the function

Examples

# Example 10.2 from "Applied Nonparametric Statistical Methods" (5th edition)
spearman(ch10$q1, ch10$q2, alternative = "greater", do.asymp = TRUE, do.exact = FALSE)

# Exercise 10.1 from "Applied Nonparametric Statistical Methods" (5th edition)
spearman(ch10$ERA, ch10$ESMS, do.exact = FALSE)

Calculate Spearman beta

Description

spearman.beta() calculates the Spearman beta and is used in chapter 11 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

spearman.beta(
  y,
  x,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  CI.width = 0.95,
  max.exact.cases = 10,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.CI = FALSE,
  do.mc = FALSE
)

Arguments

y

Numeric vector of same length as x

x

Numeric vector of same length as y

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

CI.width

Confidence interval width (defaults to 0.95)

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.asymp

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

do.exact

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

do.CI

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

do.mc

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

Value

An ANSMstat object with the results from applying the function

Examples

# Example 11.3 from "Applied Nonparametric Statistical Methods" (5th edition)
spearman.beta(ch11$reportedtime, ch11$parentlimit, H0 = 1)
spearman.beta(ch11$reportedtime, ch11$parentlimit, H0 = 1, do.CI = TRUE)

Calculate Theil-Kendall beta

Description

theil.kendall() calculates the Theil-Kendall beta and is used in chapter 11 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

theil.kendall(
  y,
  x,
  H0 = NULL,
  do.abbreviated = FALSE,
  do.alpha = FALSE,
  alternative = c("two.sided", "less", "greater"),
  CI.width = 0.95,
  max.exact.cases = 10,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.CI = FALSE,
  do.mc = FALSE
)

Arguments

y

Numeric vector of same length as x

x

Numeric vector of same length as y

H0

Null hypothesis value (defaults to NULL)

do.abbreviated

Boolean indicating whether or not to use abbreviated Theil procedure (defaults to FALSE)

do.alpha

Boolean indicating whether or not to report estimate of alpha (defaults to FALSE)

alternative

Type of alternative hypothesis (defaults to two.sided)

CI.width

Confidence interval width (defaults to 0.95)

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.asymp

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

do.exact

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

do.CI

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

do.mc

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

Value

An ANSMstat object with the results from applying the function

Examples

# Example 11.6 from "Applied Nonparametric Statistical Methods" (5th edition)
theil.kendall(ch11$reportedtime, ch11$parentlimit, do.alpha = TRUE)

# Exercise 11.10 from "Applied Nonparametric Statistical Methods" (5th edition)
theil.kendall(ch11$N.Scotland, ch11$SW.England)

Perform Wilcoxon-Mann-Whitney test

Description

wilcoxon.mann.whitney() performs the Wilcoxon-Mann-Whitney test and is used in chapters 6, 8, 9 and 12 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

wilcoxon.mann.whitney(
  x,
  y,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  cont.corr = TRUE,
  CI.width = 0.95,
  max.exact.cases = 1000,
  nsims.mc = 1e+05,
  seed = NULL,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.mc = FALSE,
  do.CI = TRUE
)

Arguments

x

Numeric vector, or factor with same levels as y

y

Numeric vector, or factor with same levels as x

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

cont.corr

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

CI.width

Confidence interval width (defaults to 0.95)

max.exact.cases

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

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.asymp

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

do.exact

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

do.mc

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

do.CI

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

Value

An ANSMtest object with the results from applying the function

Examples

# Examples 6.1 and 6.2 from "Applied Nonparametric Statistical Methods" (5th edition)
wilcoxon.mann.whitney(ch6$groupA, ch6$groupB)

# Exercise 12.4 from "Applied Nonparametric Statistical Methods" (5th edition)
wilcoxon.mann.whitney(ch12$feedback.satisfaction[ch12$PPI.person.2 == "Representative"],
  ch12$feedback.satisfaction[ch12$PPI.person.2 == "Researcher"],
  do.exact = FALSE, do.asymp = TRUE)

Perform Wilcoxon signed-rank test

Description

wilcoxon.signedrank() performs the Wilcoxon signed-rank test and is used in chapters 3, 4 and 5 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

wilcoxon.signedrank(
  x,
  H0 = NULL,
  alternative = c("two.sided", "less", "greater"),
  cont.corr = TRUE,
  CI.width = 0.95,
  max.exact.cases = 1000,
  do.asymp = FALSE,
  do.exact = TRUE,
  do.CI = TRUE
)

Arguments

x

Numeric vector

H0

Null hypothesis value (defaults to NULL)

alternative

Type of alternative hypothesis (defaults to two.sided)

cont.corr

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

CI.width

Confidence interval width (defaults to 0.95)

max.exact.cases

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

do.asymp

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

do.exact

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

do.CI

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

Value

An ANSMtest object with the results from applying the function

Examples

# Example 3.4 from "Applied Nonparametric Statistical Methods" (5th edition)
wilcoxon.signedrank(ch3$heartrates1, 70, "greater")

# Exercise 5.12 from "Applied Nonparametric Statistical Methods" (5th edition)
wilcoxon.signedrank(ch5$kHz0.125 - ch5$kHz0.25, 0)

Perform Zelen test

Description

zelen() performs the Zelen test and is used in chapter 13 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

zelen(x, y, z, max.exact.perms = 1e+06, do.exact = TRUE)

Arguments

x

Binary factor of same length as y, z

y

Binary factor of same length as x, z

z

Factor of same length as x, y

max.exact.perms

Maximum number of permutations allowed for exact calculations (defaults to 1000000)

do.exact

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

Value

An ANSMtest object with the results from applying the function

Examples

# Section 13.2.5 from "Applied Nonparametric Statistical Methods" (5th edition)
zelen(ch13$drug, ch13$side.effects, ch13$age.group)

# Example 13.3 from "Applied Nonparametric Statistical Methods" (5th edition)
zelen(ch13$machine, ch13$output.status, ch13$material.source)