Learn R Programming

microSTASIS (version 0.1.0)

CV_results: Compute the error or plot the stability values after CV_iterative_clustering().

Description

Compute the mean absolute error after the cross validation or plot lines connecting the stability values for each subset of the original matrix of paired times.

Usage

CV_results(
  data,
  cv_klist,
  output = "MAE",
  points = TRUE,
  k = 1L,
  size_line = 0.5
)

Arguments

data

input matrix with paired times, i.e. samples to be stressed to multiple iterations.

cv_klist

list resulting from CV_iterative_clustering().

output

character: MAE or viz; to return a data frame with the MAE or to visualize a line plot.

points

logical; if plotting, FALSE to only plot lines and TRUE to add points on the original stability value, i.e. result from stabilitas().

k

integer; number of individuals to subset from the data. The same as used in CV_iterative_clustering().

size_line

numeric; if plotting, size of the multiple lines.

Value

A vector with MAE values or a line plot in the form of a "ggplot" object with the values of stability for the multiple subsets and the original matrix of paired samples.

Examples

Run this code
# NOT RUN {
t1_t2 <- paired_times(data = clr, first = "_1",
                      second = "_25", common = "_0_")
klist_t1_t2 <- iterative_clustering(data = t1_t2, parallel = FALSE)
result_t1_t2 <- stabilitas(klist_t1_t2, common = "_0_")
cv_klist_t1_t2_k2 <- CV_iterative_clustering(data = t1_t2, results = result_t1_t2,
                                             common = "_0_", k = 2L, parallel = FALSE)
MAE_t1_t2 <- CV_results(data = t1_t2, cv_klist = cv_klist_t1_t2_k2,
                       output = "MAE", k = 2L)
MAE <- st_previz(results = list(MAE_t1_t2),
                 times = "MAE_t1_t2")
st_heatmap(data = MAE, label = TRUE,
           high = 'red2', midpoint = 0.075, low = 'forestgreen')
CV_results(data = t1_t2, cv_klist = cv_klist_t1_t2_k2,
           output = "viz", k = 2L)
# }

Run the code above in your browser using DataLab