UtilLesionWeightsMatrixDataset (dataset01) # FROC data
## [,1] [,2] [,3]
##[1,] 1 1.0 -Inf
##[2,] 2 0.5 0.5
UtilLesionWeightsMatrixDataset (dataset02) # ROC data
## [,1] [,2]
##[1,] 1 1
## Example 1: dataset with 1 to 4 lesions per case, with frequency as per first argument
UtilLesionWeightsMatrixLesDistr (c(0.6, 0.2, 0.1, 0.1), c(0.2, 0.4, 0.1, 0.3))
## [,1] [,2] [,3] [,4] [,5]
##[1,] 1 1.0000000 -Inf -Inf -Inf
##[2,] 2 0.3333333 0.6666667 -Inf -Inf
##[3,] 3 0.2857143 0.5714286 0.1428571 -Inf
##[4,] 4 0.2000000 0.4000000 0.1000000 0.3
## Explanation
##> c(0.2)/sum(c(0.2))
##[1] 1 ## (weights for cases with 1 lesion)
##> c(0.2, 0.4)/sum(c(0.2, 0.4))
##[1] 0.3333333 0.6666667 ## (weights for cases with 2 lesions)
##> c(0.2, 0.4, 0.1)/sum(c(0.2, 0.4, 0.1))
##[1] 0.2857143 0.5714286 0.1428571 ## (weights for cases with 3 lesions)
##> c(0.2, 0.4, 0.1, 0.3)/sum(c(0.2, 0.4, 0.1, 0.3))
##[1] 0.2000000 0.4000000 0.1000000 0.3 ## (weights for cases with 4 lesions)
## Example2 : dataset with *no* cases with 3 lesions per case
UtilLesionWeightsMatrixLesDistr (c(0.1, 0.7, 0.0, 0.2), c(0.4, 0.3, 0.2, 0.1))
## [,1] [,2] [,3] [,4]
##[1,] 1 1.0000000 -Inf -Inf
##[2,] 2 0.5714286 0.4285714 -Inf
##[3,] 4 0.5000000 0.3750000 0.125
## Explanation: note that row with 3 lesions per case does not occur
##> c(0.4)/sum(c(0.4))
##[1] 1 ## (weights for cases with 1 lesion)
##> c(0.4, 0.3)/sum(c(0.4, 0.3))
##[1] 0.5714286 0.4285714 ## (weights for cases with 2 lesions)
##> c(0.4, 0.3, 0.1)/sum(c(0.4, 0.3, 0.1))
##[1] 0.500 0.375 0.125 ## (weights for cases with 4 lesions)
Run the code above in your browser using DataLab