Package CompareTests

Similar documents
Package citccmst. February 19, 2015

Package clust.bin.pair

Package HAP.ROR. R topics documented: February 19, 2015

Package propoverlap. R topics documented: February 20, Type Package

Package speff2trial. February 20, 2015

Package p3state.msm. R topics documented: February 20, 2015

Package ordibreadth. R topics documented: December 4, Type Package Title Ordinated Diet Breadth Version 1.0 Date Author James Fordyce

Package appnn. R topics documented: July 12, 2015

Package prognosticroc

(true) Disease Condition Test + Total + a. a + b True Positive False Positive c. c + d False Negative True Negative Total a + c b + d a + b + c + d

Package singlecase. April 19, 2009

Package inctools. January 3, 2018

Package rvtdt. February 20, rvtdt... 1 rvtdt.example... 3 rvtdts... 3 TrendWeights Index 6. population control weighted rare-varaints TDT

Package preference. May 8, 2018

Package AbsFilterGSEA

Package ICCbin. November 14, 2017

Package QualInt. February 19, 2015

ivlewbel: Uses heteroscedasticity to estimate mismeasured and endogenous regressor models

Package GANPAdata. February 19, 2015

Package wally. May 25, Type Package

BMI 541/699 Lecture 16

Package nopaco. R topics documented: April 13, Type Package Title Non-Parametric Concordance Coefficient Version 1.0.

Package PELVIS. R topics documented: December 18, Type Package

Package SAMURAI. February 19, 2015

Package ORIClust. February 19, 2015

Package xseq. R topics documented: September 11, 2015

Package diggitdata. April 11, 2019

Package cssam. February 19, 2015

Package MethPed. September 1, 2018

Package frailtyhl. February 19, 2015

Package xmeta. August 16, 2017

Package ExactCIdiff. February 15, 2013

Package AIMS. June 29, 2018

Package ncar. July 20, 2018

Package mediation. September 18, 2009

7/17/2013. Evaluation of Diagnostic Tests July 22, 2013 Introduction to Clinical Research: A Two week Intensive Course

Package Actigraphy. R topics documented: January 15, Type Package Title Actigraphy Data Analysis Version 1.3.

Package Fahrmeir. May 31, 2016

Package longroc. November 20, 2017

Package bionetdata. R topics documented: February 19, Type Package Title Biological and chemical data networks Version 1.0.

Naïve Bayes classification in R

Package memapp. R topics documented: June 2, Version 2.10 Date

Package inote. June 8, 2017

AnExaminationoftheQualityand UtilityofInterviewerEstimatesof HouseholdCharacteristicsinthe NationalSurveyofFamilyGrowth. BradyWest

Package TEQR. R topics documented: February 5, Version Date Title Target Equivalence Range Design Author M.

Lesson: A Ten Minute Course in Epidemiology

Package StepReg. November 3, 2017

Answer to exercise: Growth of guinea pigs

CHL 5225 H Advanced Statistical Methods for Clinical Trials. CHL 5225 H The Language of Clinical Trials

Package influence.me

Package BUScorrect. September 16, 2018

Package labstats. December 5, 2016

Package hei. August 17, 2017

BIOSTATISTICAL METHODS

Case Studies, or Verification Vignettes

Package mdsdt. March 12, 2016

Package tumgr. February 4, 2016

Package ega. March 21, 2017

Package sbpiper. April 20, 2018

Package seqdesign. April 27, Version 1.1 Date

Statistical Tests for X Chromosome Association Study. with Simulations. Jian Wang July 10, 2012

Package Interpol. R topics documented: February 19, Type Package. Title Interpolation of amino acid sequences. Version

Package pollen. October 7, 2018

Package noia. February 20, 2015

4 Diagnostic Tests and Measures of Agreement

Epidemiologic Methods I & II Epidem 201AB Winter & Spring 2002

Finland and Sweden and UK GP-HOSP datasets

Package EpiEstim. R topics documented: February 19, Version Date 2013/03/08

Introduction to ROC analysis

Propensity Score Methods to Adjust for Bias in Observational Data SAS HEALTH USERS GROUP APRIL 6, 2018

Reliability of Ordination Analyses

Package MSstatsTMT. February 26, Title Protein Significance Analysis in shotgun mass spectrometry-based

The Australian longitudinal study on male health sampling design and survey weighting: implications for analysis and interpretation of clustered data

Unit 1 Exploring and Understanding Data

Joseph W Hogan Brown University & AMPATH February 16, 2010

Logistic Regression and Bayesian Approaches in Modeling Acceptance of Male Circumcision in Pune, India

Package NarrowPeaks. August 3, Version Date Type Package

Statistics for Clinical Trials: Basics of Phase III Trial Design

Abstract Title Page Not included in page count. Authors and Affiliations: Joe McIntyre, Harvard Graduate School of Education

Supplementary method. a a a. a a a. h h,w w, then the size of C will be ( h h + 1) ( w w + 1). The matrix K is

Simple Sensitivity Analyses for Matched Samples Thomas E. Love, Ph.D. ASA Course Atlanta Georgia

Methods to control for confounding - Introduction & Overview - Nicolle M Gatto 18 February 2015

Package ClusteredMutations

Measuring the User Experience

Small-area estimation of mental illness prevalence for schools

Empirical Knowledge: based on observations. Answer questions why, whom, how, and when.

A review of statistical methods in the analysis of data arising from observer reliability studies (Part 11) *

Improved Hepatic Fibrosis Grading Using Point Shear Wave Elastography and Machine Learning

Package msgbsr. January 17, 2019

YouGov November 10-12, 2014

Tips and Tricks for Raking Survey Data with Advanced Weight Trimming

Analysis of Variance: repeated measures

Package NonCompart. August 16, 2017

Predicting Breast Cancer Survivability Rates

Propensity Score Methods for Estimating Causality in the Absence of Random Assignment: Applications for Child Care Policy Research

Package medicalrisk. August 29, 2016

STATISTICAL METHODS FOR DIAGNOSTIC TESTING: AN ILLUSTRATION USING A NEW METHOD FOR CANCER DETECTION XIN SUN. PhD, Kansas State University, 2012

EVALUATION AND COMPUTATION OF DIAGNOSTIC TESTS: A SIMPLE ALTERNATIVE

Package DeconRNASeq. November 19, 2017

Chapter 13 Estimating the Modified Odds Ratio

Transcription:

Type Package Package CompareTests February 6, 2017 Title Correct for Verification Bias in Diagnostic Accuracy & Agreement Version 1.2 Date 2016-2-6 Author Hormuzd A. Katki and David W. Edelstein Maintainer Hormuzd Katki <katkih@mail.nih.gov> Description A standard test is observed on all specimens. We treat the second test (or sampled test) as being conducted on only a stratified sample of specimens. Verification Bias is this situation when the specimens for doing the second (sampled) test is not under investigator control. We treat the total sample as stratified two-phase sampling and use inverse probability weighting. We estimate diagnostic accuracy (category-specific classification probabilities; for binary tests reduces to specificity and sensitivity, and also predictive values) and agreement statistics (percent agreement, percent agreement by category, Kappa (unweighted), Kappa (quadratic weighted) and symmetry tests (reduces to McNemar's test for binary tests)). See: Katki HA, Li Y, Edelstein DW, Castle PE. Estimating the agreement and diagnostic accuracy of two diagnostic tests when one test is conducted on only a subsample of specimens. Stat Med. 2012 Feb 28; 31(5) <doi:10.1002/sim.4422>. License GPL-3 LazyLoad yes URL http://dceg.cancer.gov/about/staff-directory/biographies/a-j/katki-hormuzd NeedsCompilation no Repository CRAN Date/Publication 2017-02-06 16:37:03 R topics documented: CompareTests-package................................... 2 CompareTests........................................ 3 fulltable........................................... 6 specimens.......................................... 7 Index 9 1

2 CompareTests-package CompareTests-package Correct for Verification Bias in Diagnostic Accuracy & Agreement Description Details A standard test is observed on all specimens. We treat the second test (or sampled test) as being conducted on only a stratified sample of specimens. Verification Bias is this situation when the specimens for doing the second (sampled) test is not under investigator control. We treat the total sample as stratified two-phase sampling and use inverse probability weighting. We estimate diagnostic accuracy (category-specific classification probabilities; for binary tests reduces to specificity and sensitivity) and agreement statistics (percent agreement, percent agreement by category, Kappa (unweighted), Kappa (quadratic weighted) and symmetry test (reduces to McNemar s test for binary tests)). Package: CompareTests Type: Package Version: 1.1 Date: 2015-06-19 License: GPL-3 LazyLoad: yes You have a dataframe with columns "stdtest" (no NAs allowed; all specimens with NA stdtest results are dropped), "sampledtest" (a gold standard which is NA for some specimens), sampling strata "strata1" "strata2" (values cannot be missing for any specimens). Correct for Verification Bias in the diagnostic and agreement statistics with CompareTests(stdtest,sampledtest,interaction(strata1,strata2),goldstd="sampledtest") Author(s) Hormuzd A. Katki and David W. Edelstein Maintainer: Hormuzd Katki <katkih@mail.nih.gov> References Katki HA, Li Y, Edelstein DW, Castle PE. Estimating the agreement and diagnostic accuracy of two diagnostic tests when one test is conducted on only a subsample of specimens. Stat Med. 2012 Feb 28; 31(5): 10.1002/sim.4422. Examples Get specimens dataset data(specimens)

CompareTests 3 Get diagnostic and agreement statistics if sampledtest is the gold standard CompareTests(specimens$stdtest,specimens$sampledtest,specimens$stratum) Get diagnostic and agreement statistics if stdtest is the gold standard CompareTests(specimens$stdtest,specimens$sampledtest,specimens$stratum,goldstd="stdtest") Get agreement statistics if neither test is a gold standard CompareTests(specimens$stdtest,specimens$sampledtest,specimens$stratum,goldstd=FALSE) CompareTests Correct for Verification Bias in Diagnostic Accuracy & Agreement Description Usage A standard test is observed on all specimens. We treat the second test (or sampled test) as being conducted on only a stratified sample of specimens. We treat the total sample as stratified twophase sampling and use inverse probability weighting. We estimate diagnostic accuracy (categoryspecific classification probabilities; for binary tests reduces to specificity and sensitivity) and agreement statistics (percent agreement, percent agreement by category, Kappa (unweighted), Kappa (quadratic weighted) and symmetry tests (reduces to McNemar s test for binary tests)). CompareTests(stdtest, sampledtest, strata = NA, goldstd = "sampledtest") Arguments stdtest sampledtest strata goldstd A vector of standard test results. Any NA test results are dropped from the analysis entirely. A vector of test results observed only on a sample of specimens. Test results with NA are assumed to no be observed for that specimen The sampling stratum each specimen belongs to. Set to NA if no sampling or simple random sampling. For outputing diagnostic accuracy statistics, denote if "stdtest" or "sampledtest" is the gold standard. If no gold standard, set to FALSE. Value Outputs to screen the estimated contingency table of paired test results, agreement statistics, and diagnostic accuracy statistics. Returns a list with the following components Cells EstCohort Cellvars Observed contingency tables of pair test results for each stratum Weighted contingency table of each pair of test results Variance of each weighted cell count

4 CompareTests Note Cellcovars p0 Varp0 AgrCat VarAgrCat uncondsymm Margincovars Kappa Kappavar ipv VarsiPV icscp VarsiCSCP Variance-covariance matrix for each column of weighted cell counts Percent agreement Variance of percent agreement Percent agreement by each test category Variance of Percent agreement by each test category Symmetry test test statistic covariance of each pair of margins Kappa (unweighted) Variance of Kappa Each predictive value (for binary tests, NPV and PPV) Variance of each predictive value (for binary tests, NPV and PPV) Each category-specific classification probability (for binary tests, specificity and sensitivity Variance of each category-specific classification probability (for binary tests, specificity and sensitivity WeightedKappa Kappa (quadratic weights) varweightedkappa Variance of quadratic-weighted Kappa Order the categories from least to most severe, for binary (-,+) or (0,1) to make sure that what is output as sensitivity is not the specificity, or that PPV is not reported as NPV. If you have multiple variables to be crossed to represent the sampling strata, use interaction(), e.g. strata=interaction(strata1,strata2) Author(s) Hormuzd A. Katki and David W. Edelstein References Katki HA, Li Y, Edelstein DW, Castle PE. Estimating the agreement and diagnostic accuracy of two diagnostic tests when one test is conducted on only a subsample of specimens. Stat Med. 2012 Feb 28; 31(5): 10.1002/sim.4422. Examples ---- Should be DIRECTLY executable!! ---- -- ==> Define data, use random, --or do help(data=index) for the standard data sets. Stat Med Paper 2x2 Chlamydia testing verification bias example Note that p for symmetry test is 0.12 not 0.02 as reported in the Stat Med paper

CompareTests 5 Convert 2x2 Chlamydia testing table to a dataframe for analysis Include NAs for the samples where CTDT test was not conducted (HC2 was conducted on all) HC2stdtest <- c(rep(1,827),rep(0,4998)) stratum <- HC2stdtest CTDTsampledtest <- c( rep(1,800), 1,1 cell rep(0,27), 1,0 cell HC2+, CTDTrep(NA,827-800-27), HC2+, and no CTDT test done rep(1,6), 0,1 cell: HC2-, CTDT+ rep(0,396), 0,0 cell: HC2- and CTDTrep(NA,4998-6-396) HC2-, no CTDT test done ) chlamydia <- data.frame(stratum,hc2stdtest,ctdtsampledtest) Analysis temp <- CompareTests(chlamydia$HC2stdtest, chlamydia$ctdtsampledtest, chlamydia$stratum, goldstd="sampledtest" ) Example analysis of fictitious data example data(specimens) temp <- CompareTests(specimens$stdtest, specimens$sampledtest, specimens$stratum, goldstd="sampledtest") The output is The weighted contingency table: as.factor.stdtest. as.factor.sampledtest. 1 2 3 4 1 47.88 7.158 3.322 0.000 2 20.12 104.006 21.861 2.682 3 0.00 10.836 97.494 8.823 4 0.00 0.000 3.322 74.495 Agreement Statistics pct agree and 95% CI: 0.8057 ( 0.7438 0.8555 ) pct agree by categories and 95% CI est left right 1 0.6101 0.4501 0.7494 2 0.6241 0.5315 0.7083 3 0.6693 0.5562 0.7658 4 0.8340 0.6340 0.9358 Kappa and 95% CI: 0.734 ( 0.6509 0.8032 ) Weighted Kappa (quadratic weights) and 95% CI: 0.8767 ( 0.7107 0.9536 ) symmetry chi-square: 9.119 p= 0.167

6 fulltable Diagnostic Accuracy statistics est left right 1PV 0.7041 0.5422 0.8271 2PV 0.8525 0.7362 0.9229 3PV 0.7738 0.6547 0.8605 4PV 0.8662 0.6928 0.9490 est left right 1CSCP 0.8204 0.6011 0.9327 2CSCP 0.6996 0.6169 0.7710 3CSCP 0.8322 0.7219 0.9046 4CSCP 0.9573 0.5605 0.9975 fulltable fulltable attaches margins and NA/NaN category to the output of table() Description fulltable attaches margins and NA/NaN category to the output of table() Arguments same as table() Value same as returned from table() Author(s) Hormuzd A. Katki See Also table Examples The function is currently defined as function (...) { Purpose: Add the margins automatically and don't exclude NA/NaN as its own row/column and also add row/column titles. Works for mixed numeric/factor variables. For factors, the exclude option won't include the NAs as columns, that's why I need to do more work.

specimens 7 ---------------------------------------------------------------------- Arguments: Same as for table() ---------------------------------------------------------------------- Author: Hormuzd Katki, Date: 5 May 2006, 19:45 This works for purely numeric input, but not for any factors b/c exclude=null won't include NAs for them. return(addmargins(table(...,exclude=null))) Factors are harder. I have to reconstruct each factor to include NA as a level Put everything into a data frame x <- data.frame(...) For each factor (in columns), get the raw levels out, reconstruct to include NAs That is, if there are any NAs -- if none, add it as a level anyway for (i in 1:dim(x)[2]) { if ( is.factor(x[,i]) ) if ( any(is.na(x[,i])) ) x[,i] <- factor(unclass(x[,i]),labels=c(levels(x[,i]),"na"),exclude=null) else levels(x[,i]) <- c(levels(x[,i]),"na") } Make table with margins. Since NA is a level in each factor, they'll be included return(addmargins(table(x,exclude=null))) } specimens Fictitious data on specimens tested by two methods Description Usage Format stdtest has been done on everyone, and sampledtest has been done on a stratifed subsample of 275 out of 402 specimens (is NA on the other 127 specimens) data(specimens) A data frame with 402 observations on the following 3 variables. stratum 6 strata used for sampling stdtest standard test result available on all specimens sampledtest new test result available only on stratified subsample

8 specimens Examples data(specimens)

Index Topic \textasciitildekwd1 CompareTests, 3 fulltable, 6 Topic \textasciitildekwd2 CompareTests, 3 fulltable, 6 Topic datasets specimens, 7 Topic package CompareTests-package, 2 CompareTests, 3 CompareTests-package, 2 fulltable, 6 specimens, 7 9