knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Introduction

This package contains a variety of R functions to accompany the introductory statistics textbook, Investigating Statistical Concepts, Applications, and Methods (ISCAM), written by Dr. Allan Rossman and Dr. Beth Chance. These functions are to aid students in their investigations, assignments, and projects. The functions are categorized into 5 groups: Data Visualization, Summary Statistics, Hypothesis Testing, Quantiles, Rejection Regions & Power, Probability Distributions, Normal Approximations, and Overlaying Probability Distributions.

library(ISCAM)

Data Visualization

This function displays horizontal boxplot(s).

data("chickwts")
iscam_boxplot(x = chickwts$weight, explanatory = chickwts$feed, names = c("Weight", "Feed"))

This function displays horizontal dotplot(s). Optional: A second, categorical variable can also be specified and values will be calculated separately for each group.

iscam_dotplot(response = chickwts$weight, explanatory = chickwts$feed, names = c("Weight", "Feed"))

Summary Statistics

This function calculates the five number summary, mean, and standard deviation of the quantitative variable x.

iscam_summary(x = chickwts$weight)

Hypothesis Testing

This function calculates a one proportion z-test and/or interval.

iscam_onepropztest(observed = 12, n = 15, hypothesized = .5, alternative = "two.sided", conf.level = 0.95)

This function calculates a two proportion z-test and/or interval.

iscam_twopropztest(observed1 = 6, n1 = 17, observed2 = 12, n2 = 20, hypothesized = 0, alternative = "less")

This function calculates a one sample t-test and/or interval from summary statistics.

iscam_onesamplet(xbar = 70, sd = 4, n = 25, hypothesized = 68, alternative = "greater")

This function calculates a two sample t-test and/or interval from summary data.

iscam_twosamplet(x1 = 97.25, sd1 = 3.65, n1 = 8, x2 = 87.25, sd2 = 9.60, n2 = 12, hypothesized = 0, alternative = "less", conf.level = 0.95)

This function performs an exact binomial test and graphs the binomial distribution and/or binomial confidence interval.

iscam_binomtest(10, 40, hypothesized = .50, alternative = "two.sided", conf.level = 0.90)

Quantiles

This function calculates the binomial quantile of a specified probability. The integer that achieves at most the stated probability will be returned.

iscam_invbinom(alpha = .05, n = 15, prob = .20, lower.tail = FALSE)

This function calculates the normal quantile of a specified probability.

iscam_invnorm(prob1 = .55, mean = 15, sd = 2, direction = "below")

This function calculates the t quantile of a specified probability.

iscam_invt(prob1 = .35, df = 2, direction = "above")

Rejection Regions & Power

This function determines the rejection region corresponding to the level of significance and the first probability. A second, optional probability can be specified to determine the power of the test.

iscam_binompower(LOS = .05, n = 20, prob1 = 0.25, alternative = "greater", prob2 = 0.333, explain = T)

This function determines the rejection region corresponding to the level of significance and the first probability and shows the second distribution shading its corresponding region.

iscam_normpower(LOS = .05, n = 20, prob1 = .5, alternative = "less", prob2 = .7)

Probability Distributions

This function calculates either a tail probability or the inverse cumulative probability depending on whether k or prob is passed a question mark.

iscam_binom("?", 0.05, 20, 0.3, lower.tail = TRUE)
iscam_binom(10, "?", 20, 0.3, TRUE)

This function calculates tail probabilities from the binomial distribution.

iscam_binomprob(k = 20, n = 30, prob = 0.5, lower.tail = TRUE)

This function calculates tail probabilities from the hypergeometric distribution.

iscam_hyperprob(k = 2, total = 52, succ = 5, n = 13, lower.tail = FALSE)

This function calculates tail probability for the normal distribution.

iscam_normprob(xval = 2.2, direction = "above", label = "sample proportions")

This function calculates the upper tail probability for the chi-square distribution.

iscam_chisqprob(xval = 10, df = 4)

This function calculates tail probability for the t distribution.

iscam_tprob(xval = 4, df = 5, direction = "above")

Normal Approximations

This function illustrates the normal approximation to the binomial.

iscam_binomnorm(k = 20, n = 30, prob = 0.5, direction = "above")

This function calculates tail probabilities from the hypergeometric distribution.

iscam_hypernorm(k = 2, total = 52, succ = 5, n = 26, lower.tail = T)

Histograms with Overlaid Density Curves

This function creates a histogram of the inputted variable and overlays an exponential density function with lambda = 1/mean.

expdata <- rexp(50)
iscam_addexp(expdata)

This function creates a histogram of the inputted variable and overlays a log normal density function.

lnormdata <- rlnorm(50)
iscam_addlnorm(lnormdata)

This function creates a histogram of the inputted variable and overlays a normal density function.

normdata <- rnorm(50)
iscam_addnorm(normdata)

This function creates a histogram of the inputted variable and overlays a t density function with df degrees of freedom.

tdata <- rt(50, df = 5)
iscam_addt(tdata, df = 5)

This function creates a histogram of the inputted variable and overlays a t density function with df degrees of freedom and a normal density function.

iscam_addtnorm(tdata, df = 3)


apjacobson/iscam documentation built on May 6, 2019, 12:08 p.m.