UtilLesWghts.Rd
Determine the lesion weights distribution 2D matrix of a dataset or manually specify the lesion weights distribution.
UtilLesWghtsDS(dsOrArr, relWeights = 0)
UtilLesWghtsLD(LDOrArr, relWeights = 0)
A dataset object or a 1D-array, see UtilLesDistr.
The relative weights of the lesions: a unit sum vector of
length equal to the maximum number of lesions per dis. case. For example,
c(0.2, 0.4, 0.1, 0.3)
means that on cases with one lesion
the weight of the lesion is unity, on cases with two
lesions the ratio of the weight of the first lesion to that of the second
lesion is 0.2:0.4, i.e., lesion 2 is twice as important as lesion 1.
On cases with 4 lesions the weights are in the ratio 0.2:0.4:0.1:0.3.
The default is zero, in which case equal lesion weights are assumed.
The lesion distribution (LD) dataframe object produced by UtilLesDistr or a 1D-array.
The lesion distribution (LD) dataframe object produced by UtilLesDistr or a 1D-array.
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 UtilLesDistr.
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.
UtilLesWghtsDS (dataset01) # FROC data
#> [,1] [,2] [,3]
#> [1,] 1 1.0 -Inf
#> [2,] 2 0.5 0.5
## [,1] [,2] [,3]
##[1,] 1 1.0 -Inf
##[2,] 2 0.5 0.5
UtilLesWghtsDS (dataset02) # ROC data
#> [,1] [,2]
#> [1,] 1 1
## [,1] [,2]
##[1,] 1 1
UtilLesWghtsDS(c(0.7,0.2,0.1)) # only frequencies supplied
#> [,1] [,2] [,3] [,4]
#> [1,] 1 1.0000000 -Inf -Inf
#> [2,] 2 0.5000000 0.5000000 -Inf
#> [3,] 3 0.3333333 0.3333333 0.3333333
## relWeights defaults to zero
## Dataset with 1 to 4 lesions per case, with frequency as per first argument
UtilLesWghtsLD (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
## [,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)
UtilLesWghtsLD (c(0.1, 0.7, 0.0, 0.2), c(0.4, 0.3, 0.2, 0.1))
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 1 1.0000000 -Inf -Inf -Inf
#> [2,] 2 0.5714286 0.4285714 -Inf -Inf
#> [3,] 3 0.4444444 0.3333333 0.2222222 -Inf
#> [4,] 4 0.4000000 0.3000000 0.2000000 0.1
## Weights are included for non-existent `lesionID` = 3 but corresponding frequency will be zero
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 1.00000000 -Inf -Inf -Inf
## [2,] 2 0.57142857 0.42857143 -Inf -Inf
## [3,] 3 0.44444444 0.33333333 0.22222222 -Inf
## [4,] 4 0.40000000 0.30000000 0.20000000 0.1
UtilLesWghtsDS(dataset05, relWeights = c(0.78723404, 0.17021277, 0.04255319))
#> [,1] [,2] [,3] [,4]
#> [1,] 1 1.0000000 -Inf -Inf
#> [2,] 2 0.8222222 0.1777778 -Inf
#> [3,] 3 0.7872340 0.1702128 0.04255319
## [,1] [,2] [,3] [,4]
## [1,] 1 1.00000000 -Inf -Inf
## [2,] 2 0.82222222 0.17777778 -Inf
## [3,] 3 0.78723404 0.17021277 0.04255319