Compute selected scagnostics on subsets
calc_scags(
x,
y,
scags = c("outlying", "stringy", "striated", "striated2", "clumpy", "clumpy2",
"sparse", "skewed", "convex", "skinny", "monotonic", "splines", "dcor"),
out.rm = TRUE,
euclid = FALSE
)
numeric vector
numeric vector
collection of strings matching names of scagnostics to calculate: outlying, stringy, striated, striated2, striped, clumpy, clumpy2, sparse, skewed, convex, skinny, monotonic, splines, dcor
logical indicator to indicate if outliers should be removed before calculating non outlying measures
logical indicator to use Euclidean distance
A data frame that gives the single plot's scagnostic score.
calc_scags_wide
# Calculate selected scagnostics on a single pair
calc_scags(anscombe$x1, anscombe$y1, scags=c("monotonic", "outlying"))
#> # A tibble: 1 × 2
#> outlying monotonic
#> <dbl> <dbl>
#> 1 0 0.818
# Compute on long form data, or subsets
# defined by a categorical variable
require(dplyr)
#> Loading required package: dplyr
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
datasaurus_dozen %>%
group_by(dataset) %>%
summarise(calc_scags(x,y, scags=c("monotonic", "outlying", "convex")))
#> # A tibble: 13 × 4
#> dataset outlying convex monotonic
#> <chr> <dbl> <dbl> <dbl>
#> 1 away 0.107 0.795 0.0573
#> 2 bullseye 0.0555 0.890 0.0787
#> 3 circle 0.153 0.0117 0.0773
#> 4 dino 0 0.895 0.0651
#> 5 dots 0.0518 0.000900 0.126
#> 6 h_lines 0.0874 0.953 0.0520
#> 7 high_lines 0.145 0.359 0.00287
#> 8 slant_down 0.0238 0.922 0.0669
#> 9 slant_up 0.0854 0.914 0.0861
#> 10 star 0.107 0.555 0.0514
#> 11 v_lines 0.0234 0.938 0.0566
#> 12 wide_lines 0.0360 0.311 0.0522
#> 13 x_shape 0.0743 0.165 0.0205