Title: | Single Reader Between-Cases AUC Estimator with Nested Data |
---|---|
Description: | This repository provide the R package for the methods in paper: Single Reader Between-Cases AUC Estimator with Nested Data. Statistical Methods in Medical Research. https://doi.org/10.1177/09622802221111539. |
Authors: | Hongfei Du [aut, cre] |
Maintainer: | Hongfei Du <[email protected]> |
License: | CC0 |
Version: | 1.0 |
Built: | 2024-11-12 04:40:34 UTC |
Source: | https://github.com/didsr/nestmrmc |
Function for calculating 2 reader AUC covariance
AUC_cov_2reader_nest(success_score)
AUC_cov_2reader_nest(success_score)
success_score |
The success score for nested data |
the covariance between two readers' AUC
This function takes nested data as a data frame and runs a multi-reader multi-case analysis for single reader in nested data problem based on modified U-statistics as described in the following paper:
AUC_per_reader_nest(data)
AUC_per_reader_nest(data)
data |
The nested data for analysis. This dataset should have specified columns: "patient","reader1","reader2","reader3","reader4","reader5","truth","mod","region". |
This function returns a list containing three dataframes.
Here is a quick summary: AUC_per_reader [data.frame] this data frame contains the AUC estimates for each reader under different modalities (Mod1 denotes modality 1 and Mod2 denotes modality 2). AUC_Var_per_reader [data.frame] this data frame contains the AUC variance estimates for each reader under different modalities. numROI [data.frame] this data frame contains the number of positive and negative ROIs in each case.
sim.config = simu_config() data = data_MRMC(sim.config)$data_final Outputs = AUC_per_reader_nest(data)
sim.config = simu_config() data = data_MRMC(sim.config)$data_final Outputs = AUC_per_reader_nest(data)
covariance 8th moment middle calculation part one
cov_m8_f1(m)
cov_m8_f1(m)
m |
input matrix |
the middle values for calculating covariance 8th moment
covariance 8th moment middle calculation part two
cov_m8_f2(m)
cov_m8_f2(m)
m |
input matrix |
the middle values for calculating covariance 8th moment
Simulation function
data_MRMC(sim.config)
data_MRMC(sim.config)
sim.config |
list contains following parameters: I num The number of patients. k num The number of ROIs in each patient. R num The number of readers. correlation_t num The correlation for simulating truth label. potential_correlation_s num The correlation for simulating reading scores. AUC_all num The theoretical AUC values. sameclustersize boolean The binary variable to decide whether we have same number of ROIs in each patient. rho num The scale parameter that infulence the covariance matrix in multivariate normal distribution. fix_design boolean Binary variable to decide whether fix the truth label in simulation. stream num The integer control the random number generator. |
A list and the only element in the list is the simulated data with following columns: "clusterID","unitID","reader1",...,"truth"
Delete diagonal term function
delete_diag(m)
delete_diag(m)
m |
the input matrix for deleting diagonal term |
diagonal term removed matrix
function for calculating the 11th moment
m11_f(m)
m11_f(m)
m |
input matrix |
the 11th moment
function for calculating the 8th moment
m8_f(m)
m8_f(m)
m |
input matrix |
the 8th moment
Configuration function
simu_config( I = 100, k = 10, R = 2, correlation_t = 0, potential_correlation_s = rep(0.5, 4), AUC_all = rep(0.7, 2), sameclustersize = T, rho = 0.5, fix_design = F, stream = 20220210 )
simu_config( I = 100, k = 10, R = 2, correlation_t = 0, potential_correlation_s = rep(0.5, 4), AUC_all = rep(0.7, 2), sameclustersize = T, rho = 0.5, fix_design = F, stream = 20220210 )
I |
The number of patients. |
k |
The number of ROIs in each patient. |
R |
The number of readers. |
correlation_t |
The correlation for simulating truth label. |
potential_correlation_s |
The correlation for simulating reading scores. |
AUC_all |
The theoretical AUC values. |
sameclustersize |
The binary variable to decide whether we have same number of ROIs in each patient. |
rho |
The scale parameter that influence the covariance matrix in multivariate normal distribution. |
fix_design |
Binary variable to decide whether fix the truth label in simulation. |
stream |
The integer control the random number generator. |
A list of above parameters
Calculate the success score
success_score(data)
success_score(data)
data |
the nested MRMC data |
The success score and number of ROIs in each case
sum the diagonal terms
sum_diag(m)
sum_diag(m)
m |
input matrix |
sum of diagonal terms
This function calculates between-cases AUC estimator's theoretical variance and covariance based on all the truths, namely, the ROI's truth labels, AUC values, covariance between ROI scores within same reader, scale factor that influences the covariance between ROI scores between readers and the variances for positive and negative ROI scores. Detailed formulas are available in following paper: Single Reader Between-Cases AUC Estimator with Nested Data. Statistical Methods in Medical Research. https://doi.org/10.1177/09622802221111539. There is also a Rcpp version of this function in this package. The function name is 'true_AUC_var_abitrary_Rcpp', which is much faster than current version. They produce the exact same results.
true_AUC_var_abitrary( numROI, AUC = 0.7, cov = 0.5, rho = 0.5, sigma_pos = 1, sigma_neg = 1 )
true_AUC_var_abitrary( numROI, AUC = 0.7, cov = 0.5, rho = 0.5, sigma_pos = 1, sigma_neg = 1 )
numROI |
The number of positive and negative ROIs in all the patients. |
AUC |
The AUC values used in simulated data. |
cov |
The covariance used in simulating reading scores. |
rho |
The scale factor used in simulating reading scores. |
sigma_pos |
The variacne for positive ROI's reading score, defalut is 1. |
sigma_neg |
The variacne for negative ROI's reading score, defalut is 1. |
The theoretical AUC estimator's (co)variance based on the simulation settings.
This function calculates between-cases AUC estimator's theoretical variance and covariance based on all the truths, namely, the ROI's truth labels, AUC values, covariance between ROI scores within same reader, scale factor that influences the covariance between ROI scores between readers and the variances for positive and negative ROI scores. Detailed formulas are available in following paper: Single Reader Between-Cases AUC Estimator with Nested Data. Statistical Methods in Medical Research. https://doi.org/10.1177/09622802221111539. There is also a none Rcpp version of this function in this package. The function name is 'true_AUC_var_abitrary', which is slower but no need to install Rcpp. They produce the exact same results.
true_AUC_var_abitrary_Rcpp( numROI, AUC = 0.7, cov = 0.5, rho = 0.5, sigma_pos = 1, sigma_neg = 1 )
true_AUC_var_abitrary_Rcpp( numROI, AUC = 0.7, cov = 0.5, rho = 0.5, sigma_pos = 1, sigma_neg = 1 )
numROI |
The number of positive and negative ROIs in all the patients. |
AUC |
The AUC values used in simulated data. |
cov |
The covariance used in simulating reading scores. |
rho |
The scale factor used in simulating reading scores. |
sigma_pos |
The variacne for positive ROI's reading score, defalut is 1. |
sigma_neg |
The variacne for negative ROI's reading score, defalut is 1. |
The theoretical AUC estimator's (co)variance based on the simulation settings.
Calculate the each moments coefficient in variance
var_coef(numROI)
var_coef(numROI)
numROI |
number of ROIs in each case |
all the coefficients