knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
) 
set.seed(80)

checknormality: because you should always check your assumptions

Travis build
status Codecov test
coverage

Overview

The goal of checknormality is to provide implementations of popular normality tests that return the test statistics and p-values. As of 2020/11/30, the package contains an implementation of the Shapiro-Wilk Test of Normality.

A Note on the Algorithms

Shapiro-Wilk Test

Inverse of Normal CDF (Phi inverse)

stats::qnorm(p)

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("chrsshn/checknormality")

Usage

Example 1: Testing a small sample from an exponential distribution using the original, modified, and Royston approaches

set1 <- rexp (30, .8)
checknormality::sw_test (set1, "original")
checknormality::sw_test (set1, "modified")
checknormality::sw_test (set1, "royston")
stats::shapiro.test (set1) 
plot(density (set1))

Note: you can also get the W test statistic using the functions checknormality::R_get_W () and checknormality::C_get_W()

Example 2: Testing a small sample from a normal distribution using the original, modified, and Royston approaches

``` {r echo = T, eval = T} set2 <- rnorm (40, 20, 5) checknormality::sw_test (set2, "original") checknormality::sw_test (set2, "modified") checknormality::sw_test (set2, "royston") stats::shapiro.test (set2) plot(density (set2))

### Example 3: Testing a large sample from a Poisson distribution using the Royston approach
note: the original and modified approaches are only valid for n < 50 points
``` {r echo = T, eval = T}
set3 <- rpois(4000, .787)
checknormality::sw_test (set3, "royston")
stats::shapiro.test (set3)
plot(density (set3))   

Example 4: Testing a large sample from a normal distribution using the Royston approach

note: the original and modified approaches are only valid for n < 50 points ``` {r echo = T, eval = T} set4 <- rnorm(4000) checknormality::sw_test (set4, "royston") stats::shapiro.test (set4) plot(density (set4))

```



chrsshn/checknormality documentation built on Dec. 31, 2020, 10:01 p.m.