distance_psuedo_density_function: psuedo-density for objects with a distance between them

Description Usage Arguments Value Examples

View source: R/distance-psuedo-density.R

Description

DESCRIBE MORE

Usage

1
2
3
4
5
6
7
distance_psuedo_density_function(x, x_new = NULL, sigma = 1, df_out = "auto")

## S3 method for class 'matrix'
distance_psuedo_density_function(x, x_new = NULL, sigma = 1, df_out = F)

## S3 method for class 'tidy_dist_mat'
distance_psuedo_density_function(x, x_new = NULL, sigma = 1, df_out = T)

Arguments

x

a n x n square positive symmetric matrix or a tidy_dist_mat

x_new

a n_new x n matrix or tidy_dist_mat where the rows correspond to new observations, the columns correspond to points in x (if x and x_new are matrices then they need to be corrected ordered). If this value is not NULL (default is NULL) then the psuedo-density vector will be calculated for these observations relative to observations defined with x and x_new's columns.

sigma

scaling parameter. Can either by a standard numerical value or a string as a percentage (e.g. "20%")

df_out

indicates if one should return a data.frame our a vector, by default returns data.frame if dist_mat is a tidy_dist_mat, and a vector if dist_mat is a matrix.

Value

depth vector length n with depth values associated with indices in x or a data.frame with a column called psuedo_density

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## matrix-only examples 
dist_mat <- matrix(c(0,   1, 1.5,
                     1,   0, 2,
                     1.5, 2, 0   ),
                   nrow = 3,
                   byrow = TRUE)

dd_vec <- local_distance_depth_function(dist_mat) # c(1,0,0)

ldd_vec1 <- local_distance_depth_function(dist_mat, tau = 2) # c(1,0,0)
ldd_vec2 <- local_distance_depth_function(dist_mat, tau = 1.5) # c(1,0,0)
ldd_vec3 <- local_distance_depth_function(dist_mat, tau = 1) # c(0,0,0)
ldd_vec <- local_distance_depth_function(dist_mat, tau = .1) # c(0,0,0)

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