UtilLesionWeightsMatrix {RJafroc} | R Documentation |
Determine lesion weights distribution 2D matrix
Description
Determine the lesion weights distribution 2D matrix of a dataset or manually specify the lesion weights distribution 2D matrix.
Usage
UtilLesionWeightsMatrixDataset(dataset, relWeights = 0)
UtilLesionWeightsMatrixLesDistr(lesDistr, relWeights = 0)
Arguments
dataset |
A dataset object. |
relWeights |
The relative weights of the lesions: a unit sum vector of
length equal to the maximum number of lesions per dis. case. For example,
|
lesDistr |
A unit sum vector of length equal to the maximum number of
lesions per diseased case, specifying the relative frequency of lesions
per dis. case in the dataset. For example, |
Details
Two characteristics of an FROC dataset, apart from the
ratings, affect the FOM: the distribution of lesion per case and the
distribution of lesion weights. This function addresses the weights.
The distribution of lesions is addressed in UtilLesionDistrVector.
See
PlotRsmOperatingCharacteristics for a function that depends on
lesWghtDistr
.
The underlying assumption is that lesion 1 is the same type across all
diseased cases, lesion 2 is the same type across all diseased cases,
..., etc. This allows assignment of weights independent of the case index.
Value
lesWghtDistr The 2D lesion weights distribution matrix. The first
column enumerates the number of lesions per case, while the remaining
columns contain the weights.
Missing values are filled with -Inf
. Not to be
confused with the lesionWeight
list member in an FROC dataset,
which enumerates the weights of lesions on individual cases.
Examples
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)