Learn R Programming

ANSM5 (version 1.1.1)

pearson: 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
)

Value

An ANSMstat object with the results from applying the function

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)

Examples

Run this code
# 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")

Run the code above in your browser using DataLab