Compute the chisquare goodness of fit statistic for specified ROC data fitting model

ChisqrGoodnessOfFit(fpCounts, tpCounts, parameters, model, lesDistr)

## Arguments

fpCounts

The FP counts table

tpCounts

The TP counts table

parameters

The parameters of the model including cutoffs, see details

model

The fitting model: "BINORMAL", "CBM" or "RSM

lesDistr

The lesion distribution matrix; not needed for "BINORMAL" or "CBM" models. Array [1:maxLL,1:2]. The probability mass function of the lesion distribution for diseased cases. The first column contains the actual numbers of lesions per case. The second column contains the fraction of diseased cases with the number of lesions specified in the first column. The second column must sum to unity.

## Value

A list with the following elements:

chisq

The chi-square statistic

pVal

The p-value of the fit

df

The degrees of freedom

## Details

For model = "BINORMAL" the parameters are c(a,b,zetas). For model = "CBM" the parameters are c(mu,alpha,zetas). For model = "RSM" the parameters are c(mu,lambda,nu,zetas). Due to the sparsity of the data, in most cases the goodness of fit statistic cannot be calculated as the criterion of at least 5 counts in each cell (TP and FP) is usually not met. An exception dataset is shown below.

## Examples

## Test with TONY data for which chisqr can be calculated
ds <- DfFroc2Roc(dataset01)
fit <- FitBinormalRoc(ds, 2, 3) # trt 2 and rdr 3
## fitted a,b and zeta parameters from preceding line were used to call the
## function as shown below:
fpCounts = c(119,  30,   9,  19,   7,   1)
tpCounts = c(10, 11,  7, 16, 29, 16)
gfit = ChisqrGoodnessOfFit(fpCounts, tpCounts,
parameters = c(fit$a, fit$b, fit\$zetas), model="BINORMAL")