`Ch17Vig1PlotRsmOpCh.Rmd`

- The purpose of this vignette is to explain the operating characteristics predicted by the RSM. It relates to Chapter 17 in my book (Chakraborty 2017).
- This vignette is under development …
- Also to explain the difference between
`dataset`

members (`lesionID`

,`lesionWeight`

) and (`lesDist`

,`lesWghtDistr`

), which are RSM model parameters.

- Operating characteristics predicted by a model have zero sampling variability.

- Empirical operating characteristics, which apply to datasets, have non-zero sampling variability.
- If the model is corect, as the numbers of cases in the dataset increases, the empirical operating characteristic asymptotically approaches the predicted curve.

- The 3 RSM parameters and two additional parameters characterizing the dataset determine the wAFROC curve.
- The 3 RSM parameters are \(\mu\), \(\lambda\) and \(\nu\).
- The two dataset parameters are:
- The distribution of number of lesions per diseased case,
`lesDist`

. - The distribution of lesion weights,
`lesWghtDistr`

.

- The distribution of number of lesions per diseased case,
- These parameters do not apply to individual cases; rather they refer to a large population (asymptotically infinite in size) of cases.

```
str(dataset04$lesionID)
#> num [1:100, 1:3] 1 1 1 1 1 1 1 1 1 1 ...
str(dataset04$lesionWeight)
#> num [1:100, 1:3] 1 1 1 1 1 1 1 1 1 1 ...
```

- Note that the first index of both arrays is the case index for the 100 abnormal cases in this dataset.
- With finite number of cases the empirical operating characteristic (or for that matter any fitted operating characteristic) will have sampling variability as in the following example.

```
p <- PlotEmpiricalOperatingCharacteristics(dataset04, opChType = "wAFROC")
p$Plot
```

- The piecewise linear nature of the plot, with sharp breaks, indicates that this is due to a finite dataset.
- In contrast the following code shows a smooth plot, because it is a model
*predicted*plot.

```
## Following example is for mu = 2, lambda = 1, nu = 0.6. 20% of the diseased
## cases have a single lesion, 40% have two lesions, 10% have 3 lesions,
## and 30% have 4 lesions.
lesDistr <- rbind(c(1, 0.2), c(2, 0.4), c(3, 0.1), c(4, 0.3))
## On cases with one lesion the weights are 1, on cases with 2 lesions the weights
## are 0.4 and 0.6, on cases with three lesions the weights are 0.2, 0.3 and 0.5, and
## on cases with 4 lesions the weights are 0.3, 0.4, 0.2 and 0.1:
lesWghtDistr <- rbind(c(1, 1.0, -Inf, -Inf, -Inf),
c(2, 0.4, 0.6, -Inf, -Inf),
c(3, 0.2, 0.3, 0.5, -Inf),
c(4, 0.3, 0.4, 0.2, 0.1))
p <- PlotRsmOperatingCharacteristics(mu = 2, lambda = 1, nu = 0.6, OpChType = "wAFROC",
lesDistr = lesDistr, lesWghtDistr = lesWghtDistr,
legendPosition = "bottom", nlfRange = c(0, 1), llfRange = c(0, 1))
p$wAFROCPlot
```

```
lesDistr
#> [,1] [,2]
#> [1,] 1 0.2
#> [2,] 2 0.4
#> [3,] 3 0.1
#> [4,] 4 0.3
lesWghtDistr
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 1 1.0 -Inf -Inf -Inf
#> [2,] 2 0.4 0.6 -Inf -Inf
#> [3,] 3 0.2 0.3 0.5 -Inf
#> [4,] 4 0.3 0.4 0.2 0.1
```

- The second column of
`lesDistr`

specifies the fraction of diseased cases with the number of lesions specified in the first column. - The first column of
`lesWghtDistr`

is a copy of the first column of`lesDistr`

. The remaining non-`-Inf`

entries are the weights. - For cases with 1 lesion, the weight is 1.
- For cases with 2 lesions, the first lesion has weight 0.4 and the second lesion has weight 0.6, which sum to unity.
- For cases with 3 lesions, the respective weights are 0.2, 0.3 and 0.5, which sum to unity.
- For cases with 4 lesions, the respective weights are 0.3, 0.4, 0.2 and 0.1, which sum to unity.

- By changing
`OpChType`

one can generate other operating characteristics. - Note that lesiion weights argument is not needed for ROC curves. It is only needed for
`wAFROC`

and`wAFROC1`

curves.

```
lesDistr <- rbind(c(1, 0.2), c(2, 0.4), c(3, 0.1), c(4, 0.3))
p <- PlotRsmOperatingCharacteristics(mu = 2, lambda = 1, nu = 0.6, OpChType = "ROC",
lesDistr = lesDistr,
legendPosition = "bottom")
p$ROCPlot
```