Detection of observations outliers based on residuals values according to two different methods: Grubb's test or a non-parametric method.

detect_outliers(run, compartment = NULL, residuals = NULL,
  method = "grubbs", grubbs_pvalue_threshold = 0.05,
  boxplot_coefficient = 3, keep_time_zero = FALSE)

Arguments

run

pmxploit NONMEM run object.

compartment

integer. Number of the compartment of the observations of interest.

residuals

character. Column name of the residuals in the output tables.

method

character. One of "grubbs" (for iterative Grubb's test) or "boxplot" (for non-parametric detection).

grubbs_pvalue_threshold

numeric. p-value threshold for Grubb's test.

boxplot_coefficient

numeric. k coefficient for non-parametric test.

keep_time_zero

logical. If TRUE, does not ignore values at initiation (when TIME = 0). Default is FALSE.

Value

A list with the following structure:

  • method: character string of outlier detection method.

  • residuals: character string of the type of residuals.

  • source: tibble of the data source.

  • outliers: tibble of the outliers with 5 columns: ID, TIME, CMT, DV and "residuals".

Examples

EXAMPLERUN %>% detect_outliers(compartment = 2, residuals = "CWRES", method = "grubbs")
#> $method #> [1] "grubbs" #> #> $residuals #> [1] "CWRES" #> #> $source #> # A tibble: 4,408 x 6 #> ID TIME CMT DV PRED CWRES #> <ord> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 1 0.125 2 0.863 53.2 0 #> 2 1 0.208 2 2.04 52.3 0 #> 3 1 0.375 2 5.15 50.6 0 #> 4 1 1.04 2 12.8 45.0 0 #> 5 1 2.04 2 21.0 38.7 0 #> 6 1 3.04 2 23.8 34.3 -0.869 #> 7 1 8.02 2 16.7 23.0 -0.410 #> 8 1 10.0 2 13.4 20.0 -0.479 #> 9 1 21.0 2 2.82 7.99 -1.34 #> 10 1 28.0 2 0.993 4.21 -1.23 #> # … with 4,398 more rows #> #> $outliers #> # A tibble: 13 x 7 #> ID TIME CMT DV PRED CWRES dataset_row_index #> <ord> <dbl> <dbl> <dbl> <dbl> <dbl> <int> #> 1 524 6.99 2 555. 94.6 7.19 11443 #> 2 422 88.0 2 59.0 0.0425 5.77 8851 #> 3 525 70.0 2 358. 70.7 5.63 11484 #> 4 306 70.0 2 165. 40.5 5.48 6864 #> 5 471 56.0 2 183. 28.8 5.28 10060 #> 6 492 98 2 153. 9.98 5.01 10625 #> 7 97 0.417 2 99.3 21.2 4.84 2839 #> 8 414 165. 2 148. 1.93 4.64 8698 #> 9 416 112. 2 67.6 1.00 4.63 8730 #> 10 205 138. 2 2.66 0.0424 4.53 4990 #> 11 150 15.0 2 73.3 30.9 4.46 3972 #> 12 480 56 2 42.0 23.5 4.29 10298 #> 13 386 224. 2 2.85 0.0846 3.55 8153 #>
EXAMPLERUN %>% detect_outliers(compartment = 2, residuals = "CWRES", method = "grubbs", grubbs_pvalue_threshold = 0.10)
#> $method #> [1] "grubbs" #> #> $residuals #> [1] "CWRES" #> #> $source #> # A tibble: 4,408 x 6 #> ID TIME CMT DV PRED CWRES #> <ord> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 1 0.125 2 0.863 53.2 0 #> 2 1 0.208 2 2.04 52.3 0 #> 3 1 0.375 2 5.15 50.6 0 #> 4 1 1.04 2 12.8 45.0 0 #> 5 1 2.04 2 21.0 38.7 0 #> 6 1 3.04 2 23.8 34.3 -0.869 #> 7 1 8.02 2 16.7 23.0 -0.410 #> 8 1 10.0 2 13.4 20.0 -0.479 #> 9 1 21.0 2 2.82 7.99 -1.34 #> 10 1 28.0 2 0.993 4.21 -1.23 #> # … with 4,398 more rows #> #> $outliers #> # A tibble: 13 x 7 #> ID TIME CMT DV PRED CWRES dataset_row_index #> <ord> <dbl> <dbl> <dbl> <dbl> <dbl> <int> #> 1 524 6.99 2 555. 94.6 7.19 11443 #> 2 422 88.0 2 59.0 0.0425 5.77 8851 #> 3 525 70.0 2 358. 70.7 5.63 11484 #> 4 306 70.0 2 165. 40.5 5.48 6864 #> 5 471 56.0 2 183. 28.8 5.28 10060 #> 6 492 98 2 153. 9.98 5.01 10625 #> 7 97 0.417 2 99.3 21.2 4.84 2839 #> 8 414 165. 2 148. 1.93 4.64 8698 #> 9 416 112. 2 67.6 1.00 4.63 8730 #> 10 205 138. 2 2.66 0.0424 4.53 4990 #> 11 150 15.0 2 73.3 30.9 4.46 3972 #> 12 480 56 2 42.0 23.5 4.29 10298 #> 13 386 224. 2 2.85 0.0846 3.55 8153 #>
EXAMPLERUN %>% detect_outliers(compartment = 2, residuals = "CWRES", method = "boxplot")
#> $method #> [1] "boxplot" #> #> $residuals #> [1] "CWRES" #> #> $source #> # A tibble: 4,408 x 6 #> ID TIME CMT DV PRED CWRES #> <ord> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 1 0.125 2 0.863 53.2 0 #> 2 1 0.208 2 2.04 52.3 0 #> 3 1 0.375 2 5.15 50.6 0 #> 4 1 1.04 2 12.8 45.0 0 #> 5 1 2.04 2 21.0 38.7 0 #> 6 1 3.04 2 23.8 34.3 -0.869 #> 7 1 8.02 2 16.7 23.0 -0.410 #> 8 1 10.0 2 13.4 20.0 -0.479 #> 9 1 21.0 2 2.82 7.99 -1.34 #> 10 1 28.0 2 0.993 4.21 -1.23 #> # … with 4,398 more rows #> #> $outliers #> # A tibble: 12 x 7 #> ID TIME CMT DV PRED CWRES dataset_row_index #> <ord> <dbl> <dbl> <dbl> <dbl> <dbl> <int> #> 1 524 6.99 2 555. 94.6 7.19 11443 #> 2 422 88.0 2 59.0 0.0425 5.77 8851 #> 3 525 70.0 2 358. 70.7 5.63 11484 #> 4 306 70.0 2 165. 40.5 5.48 6864 #> 5 471 56.0 2 183. 28.8 5.28 10060 #> 6 492 98 2 153. 9.98 5.01 10625 #> 7 97 0.417 2 99.3 21.2 4.84 2839 #> 8 414 165. 2 148. 1.93 4.64 8698 #> 9 416 112. 2 67.6 1.00 4.63 8730 #> 10 205 138. 2 2.66 0.0424 4.53 4990 #> 11 150 15.0 2 73.3 30.9 4.46 3972 #> 12 480 56 2 42.0 23.5 4.29 10298 #>