Skip to contents

Provides a summary of the outliers present in the asreml model. Gives context to the outliers by showing the responses for the same factor combinations as the outliers

Usage

outlier_summary(model, cutoff = 3.5)

Arguments

model

The model object to detect outliers in.

The value may be:

  • asreml

  • glmmTMB (not yet implemented)

cutoff

numeric The magnitude of a point's residual to be considered an outlier.

Value

NULL Prints:

  • The number of outliers.

  • A table of the outliers, if any.

  • A table of relevant context to some factor combinations, if there are outliers.

Examples

library(asreml)
model <- asreml(
    fixed = weight ~ littersize + Dose + Sex + Dose:Sex,
    random = ~idv(Dam),
    residual = ~units,
    data = rats
)
outlier_summary(model)
#> ! No aom = T, updating model
#> 
#> ── Outliers detected: 2 ────────────────────────────────────────────────────────
#>    Dose Sex littersize Dam weight units combined_trt residuals
#> 56    C   F         13   5   5.02    56       13_C_F -4.020632
#> 66    C   F          9   6   3.68    66        9_C_F -7.877422
#> 
#> ── Data table ──
#> 
#>     Dose Sex littersize Dam weight units combined_trt  residuals
#> 56     C   F         13   5   5.02    56       13_C_F -4.0206317
#> 53     C   F         13   5   7.16    53       13_C_F  1.4705108
#> 55     C   F         13   5   7.14    55       13_C_F  1.4191918
#> 57     C   F         13   5   6.04    57       13_C_F -1.4033581
#> 54     C   F         13   5   7.09    54       13_C_F  1.2908940
#> 129    C   F         13  10   5.92   129       13_C_F -1.0564320
#> 126    C   F         13  10   6.67   126       13_C_F  0.8629802
#> 128    C   F         13  10   6.53   128       13_C_F  0.5046899
#> 130    C   F         13  10   6.52   130       13_C_F  0.4790978
#> 125    C   F         13  10   6.44   125       13_C_F  0.2743605
#> 131    C   F         13  10   6.44   131       13_C_F  0.2743605
#> 127    C   F         13  10   6.43   127       13_C_F  0.2487683
#> 66     C   F          9   6   3.68    66        9_C_F -7.8774217
#> 64     C   F          9   6   7.26    64        9_C_F  1.4570300
#> 65     C   F          9   6   6.58    65        9_C_F -0.3159943