get_cpt_neighbors {tip} | R Documentation |
Estimate the number of similar subjects
Description
Estimate the number of similar subjects using univariate multiple change point detection (i.e., binary segmentation in the changepoint package).
Usage
get_cpt_neighbors(.distance_matrix)
Arguments
.distance_matrix |
Matrix: a symmetric n x n matrix of distance values. |
Value
Vector of positive integers: a vector of positive integers where the (i)th integer corresponds to the number of subjects (observations) that are similar to the (i)th subject.
Examples
# Import the tip library
library(tip)
# Choose an arbitrary random seed
set.seed(007)
# Generate some data (i.e., 20 subjects described by a 5 x 1 vector)
X <- matrix(rnorm(10*10),nrow=20,ncol=5)
# Compute the pairwise distances between the subjects
distance_matrix <- data.matrix(dist(X))
# For each subject, find the estimate for the number of similar subjects
get_cpt_neighbors(.distance_matrix = distance_matrix)
[Package tip version 0.1.0 Index]