augment.mnr: Augment data with information from an 'mnr' object

Description Usage Arguments Value See Also Examples

View source: R/mnr.R

Description

Augment accepts an mnr object (returned from the function maximum_normed_residual()) and a dataset and adds the column .outlier to the dataset. The column .outlier is a logical vector indicating whether each observation is an outlier.

When passing data into augment using the data argument, the data must be exactly the data that was passed to maximum_normed_residual.

Usage

1
2
## S3 method for class 'mnr'
augment(x, data = x$data, ...)

Arguments

x

an mnr object created by maximum_normed_residual()

data

a data.frame or tibble::tibble() containing the original data that was passed to maximum_normed_residual

...

Additional arguments. Not used. Included only to match generic signature.

Value

When data is supplied, augment returns data, but with one column appended. When data is not supplied, augment returns a new tibble::tibble() with the column values containing the original values used by maximum_normed_residaul plus one additional column. The additional column is:

See Also

maximum_normed_residual()

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
26
27
data <- data.frame(strength = c(80, 98, 96, 97, 98, 120))
m <- maximum_normed_residual(data, strength)

# augment can be called with the original data
augment(m, data)

##   strength .outlier
## 1       80    FALSE
## 2       98    FALSE
## 3       96    FALSE
## 4       97    FALSE
## 5       98    FALSE
## 6      120    FALSE

# or augment can be called without the orignal data and it will be
# reconstructed
augment(m)

## # A tibble: 6 x 2
##   values .outlier
##    <dbl> <lgl>
## 1     80 FALSE
## 2     98 FALSE
## 3     96 FALSE
## 4     97 FALSE
## 5     98 FALSE
## 6    120 FALSE

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