Package 'NestMRMC'

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

Help Index


Function for calculating 2 reader AUC covariance

Description

Function for calculating 2 reader AUC covariance

Usage

AUC_cov_2reader_nest(success_score)

Arguments

success_score

The success score for nested data

Value

the covariance between two readers' AUC


MRMC analysis in nested data problem

Description

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:

Usage

AUC_per_reader_nest(data)

Arguments

data

The nested data for analysis. This dataset should have specified columns: "patient","reader1","reader2","reader3","reader4","reader5","truth","mod","region".

Value

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. 

Examples

sim.config = simu_config()
 
data = data_MRMC(sim.config)$data_final

Outputs = AUC_per_reader_nest(data)

covariance 8th moment middle calculation part one

Description

covariance 8th moment middle calculation part one

Usage

cov_m8_f1(m)

Arguments

m

input matrix

Value

the middle values for calculating covariance 8th moment


covariance 8th moment middle calculation part two

Description

covariance 8th moment middle calculation part two

Usage

cov_m8_f2(m)

Arguments

m

input matrix

Value

the middle values for calculating covariance 8th moment


Simulation function

Description

Simulation function

Usage

data_MRMC(sim.config)

Arguments

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.

Value

A list and the only element in the list is the simulated data with following columns: "clusterID","unitID","reader1",...,"truth"


Delete diagonal term function

Description

Delete diagonal term function

Usage

delete_diag(m)

Arguments

m

the input matrix for deleting diagonal term

Value

diagonal term removed matrix


function for calculating the 11th moment

Description

function for calculating the 11th moment

Usage

m11_f(m)

Arguments

m

input matrix

Value

the 11th moment


function for calculating the 8th moment

Description

function for calculating the 8th moment

Usage

m8_f(m)

Arguments

m

input matrix

Value

the 8th moment


Configuration function

Description

Configuration function

Usage

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
)

Arguments

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.

Value

A list of above parameters


Calculate the success score

Description

Calculate the success score

Usage

success_score(data)

Arguments

data

the nested MRMC data

Value

The success score and number of ROIs in each case


sum the diagonal terms

Description

sum the diagonal terms

Usage

sum_diag(m)

Arguments

m

input matrix

Value

sum of diagonal terms


Calculate the between-cases AUC estimator's theoretical variance and covariance

Description

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.

Usage

true_AUC_var_abitrary(
  numROI,
  AUC = 0.7,
  cov = 0.5,
  rho = 0.5,
  sigma_pos = 1,
  sigma_neg = 1
)

Arguments

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.

Value

The theoretical AUC estimator's (co)variance based on the simulation settings.


Calculate the between-cases AUC estimator's theoretical variance and covariance

Description

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.

Usage

true_AUC_var_abitrary_Rcpp(
  numROI,
  AUC = 0.7,
  cov = 0.5,
  rho = 0.5,
  sigma_pos = 1,
  sigma_neg = 1
)

Arguments

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.

Value

The theoretical AUC estimator's (co)variance based on the simulation settings.


Calculate the each moments coefficient in variance

Description

Calculate the each moments coefficient in variance

Usage

var_coef(numROI)

Arguments

numROI

number of ROIs in each case

Value

all the coefficients