R: Compute the sensitivities (probability of true positive) of...
Sensitivity
R Documentation
Compute the sensitivities (probability of true positive) of each cluster
Description
The sensitivity or conditional probability of the correct classification of cluster k is calculated as follows:
First, the proportions of observations whose true cluster label is k
are computed for each classified clusters.
Then the largest proportion is selected as the conditional probability of the correct classification.
Since this calculation can return 1 for sensitivities of all clusters if all observations
belong to one cluster, we also report the observed cluster labels
returned by the algorithms.
Usage
Sensitivity(label1, label2)
Arguments
label1
A vector of length N, containing the cluster labels from any clustering algorithms.
label2
A vector of length N, containing the true cluster labels.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(RSKC)
Loading required package: flexclust
Loading required package: grid
Loading required package: lattice
Loading required package: modeltools
Loading required package: stats4
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RSKC/condProb.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Sensitivity
> ### Title: Compute the sensitivities (probability of true positive) of each
> ### cluster
> ### Aliases: Sensitivity
>
> ### ** Examples
>
> vec1<-c(1,1,1,2,3,3,3,2,2)
> vec2<-c(3,3,3,1,1,2,2,1,1)
> Sensitivity(vec1,vec2)
$prob
1 2 3
Sensitivity. (%) 75 100 100
Class label by label1. 2 3 1
$table
label2
label1 1 2 3
1 0 0 3
2 3 0 0
3 1 2 0
$marginal
label2
label1 1 2 3
1 0.00 0.00 1.00
2 0.75 0.00 0.00
3 0.25 1.00 0.00
>
>
>
>
>
>
> dev.off()
null device
1
>