outlierSTA: Identifying outliers in objects of class STA

View source: R/outliers.R

outlierSTAR Documentation

Identifying outliers in objects of class STA

Description

Function to identify observations with standardized residuals exceeding rLimit. If not provided rLimit is computed as qnorm(1 - 0.5 / rDf) where rDf is the residual degrees of freedom for the model. This value is then restricted to the interval 2..4. Alternatively a custom limit may be provided.
If verbose = TRUE a summary is printed of outliers and observations that have the same value for commonFactors. The column outlier in the output can be used to distinguish real outliers from observations included because of their commonFactors.

Usage

outlierSTA(
  STA,
  trials = NULL,
  traits = NULL,
  what = NULL,
  rLimit = NULL,
  commonFactors = NULL,
  verbose = TRUE
)

Arguments

STA

An object of class STA.

trials

A character vector specifying the trials for which outliers should be identified. If trials = NULL, all trials are included.

traits

A character vector specifying the traits for which outliers should be identified.

what

A character string indicating whether the outliers should be identified for the fitted model with genotype as fixed (what = "fixed") or genotype as random (what = "random") factor. If STA contains only one model this model is chosen automatically.

rLimit

A numerical value used for determining when a value is considered an outlier. All observations with standardized residuals exceeding rLimit will be marked as outliers.

commonFactors

A character vector specifying the names of columns in TD used for selecting observations that are similar to the outliers. If commonFactors = NULL, only outliers are reported and no similar observations.

verbose

Should the outliers be printed to the console?

Value

A list with two components:

  • indicator - a list of numeric vectors indicating the location of the outliers in the data

  • outliers - a data.frame containing the outliers and observations similar to the outliers as defined by commonFactors

Examples

## Fit a model using lme4.
modLme <- fitTD(TD = TDHeat05,
                traits = "yield",
                design = "res.rowcol",
                engine = "lme4")

## Detect outliers in the standardized residuals of the fitted model.
outliers <- outlierSTA(STA = modLme,
                       traits = "yield")


statgenSTA documentation built on Nov. 3, 2023, 5:08 p.m.