maximum_normed_residual: Detect outliers using the maximum normed residual method

Description Usage Arguments Details Value References Examples

View source: R/mnr.R

Description

This function detects outliers using the maximum normed residual method described in CMH-17-1G. This method identifies a value as an outlier if the absolute difference between the value and the sample mean divided by the sample standard deviation exceeds a critical value.

Usage

1
maximum_normed_residual(data = NULL, x, alpha = 0.05)

Arguments

data

a data.frame

x

the variable in the data.frame for which to find the MNR or a vector if data=NULL

alpha

the significance level for the test. Defaults to 0.05

Details

data is an optional argument. If data is given, it should be a data.frame (or similar object). When data is specified, the value of x is expected to be a variable within data. If data is not specified, x must be a vector.

The maximum normed residual test is a test for outliers. The test statistic is given in CMH-17-1G. Outliers are identified in the returned object.

The maximum normed residual test statistic is defined as:

MNR = max | x_i- x_bar | / s

When the value of the MNR test statistic exceeds the critical value defined in Section 8.3.3.1 of CMH-17-1G, the corresponding value is identified as an outlier. It is then removed from the sample, and the test statistic is computed again and compared with the critical value corresponding with the new sample. This process is repeated until no values are identified as outliers.

Value

an object of class mnr This object has the following fields:

References

“Composite Materials Handbook, Volume 1. Polymer Matrix Composites Guideline for Characterization of Structural Materials,” SAE International, CMH-17-1G, Mar. 2012.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
library(dplyr)

carbon.fabric.2 %>%
  filter(test=="FC" & condition=="ETW2" & batch=="A") %>%
  maximum_normed_residual(strength)

## Call:
## maximum_normed_residual(data = ., x = strength)
##
## MNR =  1.958797  ( critical value = 1.887145 )
##
## Outliers ( alpha = 0.05 ):
##   Index  Value
##       6  44.26

carbon.fabric.2 %>%
  filter(test=="FC" & condition=="ETW2" & batch=="B") %>%
  maximum_normed_residual(strength)

## Call:
## maximum_normed_residual(data = ., x = strength)
##
## MNR =  1.469517  ( critical value = 1.887145 )
##
## No outliers detected ( alpha = 0.05 )

cmstatr documentation built on Sept. 30, 2021, 5:08 p.m.