mid_score: Calculate Midpoint

Description Usage Arguments Value Examples

View source: R/albatross_functions.R

Description

For a given [0,1] cutoff value, this function calculates the midpoint between within group clustering and out-of-group exclusion. It's primary purpose is internal use for other functions.

Usage

1
mid_score(dist_mat, cut_off = 0, group = colnames(dist_mat)[1])

Arguments

dist_mat

A [0, 1] bounded square distance matrix with column names matching groups.

cut_off

A [0, 1] bounded scalar that specifies cutoff. Defaults to 0.

group

A character string specifying group of interest. Default if first group in matrix.

Value

returns [0, 1] bounded midpoint

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set.seed(123)
groups <- 5
n_groups <- 5
n_obs <- groups * n_groups
group_names <- rep(letters[1:groups], each = 5)
example_dist <- sample(1:100, size = 25) %>%
  dist %>%
as.matrix
example_dist <- example_dist/max(example_dist)
colnames(example_dist) <- group_names
mid_score(example_dist, cut_off = 0.2, group_names[1])

silastittes/albatross documentation built on April 19, 2018, 3:31 a.m.