quantile_curves_to_points: Pull top (1-alpha)% quantile percent of curves points.

Description Usage Arguments Details Value Examples

View source: R/distance-depth.R

Description

pulling out data points from curves that are ranked highest based on quantile function.

Usage

 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
quantile_curves_to_points(
  x,
  alpha,
  dist_mat,
  dist_func = distance_depth_function,
  ...
)

## S3 method for class 'list'
quantile_curves_to_points(
  x,
  alpha,
  dist_mat,
  dist_func = distance_depth_function,
  ...
)

## S3 method for class 'grouped_df'
quantile_curves_to_points(
  x,
  alpha,
  dist_mat,
  dist_func = distance_depth_function,
  ...
)

Arguments

x

list or grouped_df containing curves, with index ordering associated with the dist_mat's row ordering

alpha

the proportion of curves to be removed before presenting all the points together. Takes value in [0, 1.0].

dist_mat

distance matrix

dist_func

function to calculate quantiles via the distance_matrix

...

additional parameters to be passed to the dist_func

Details

This function for lists (renamed as depth_curves_to_points) is shared with TCpredictionbands on github: TCpredictionbands.

Value

data frame from curves of the top values associated with the dist_func

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(dplyr)
set.seed(1)
random_data_list <- lapply(1:5, function(x){data.frame(matrix(rnorm(10),
                                                              ncol = 2))})

dist_mat <- dist_matrix_innersq_direction(random_data_list,
                                position = 1:2,
                                verbose = FALSE)

combined_points_list <- quantile_curves_to_points(random_data_list,
                                               alpha = .2,
                                               dist_mat)

random_data_grouped <- random_data_list %>%
  do.call(rbind, .) %>%
  mutate(id = rep(1:5, each = 5)) %>%
  group_by(id)

combined_points_grouped <- quantile_curves_to_points(random_data_grouped,
                                                  alpha = .2,
                                                  dist_mat)

skgallagher/EpiCompare documentation built on Sept. 14, 2021, 5:45 a.m.