Skip to content

Commit

Permalink
Nesting the vignette study in a diabetes population to reduce size. S…
Browse files Browse the repository at this point in the history
…tarted work on evaluation routines for surivival models.
  • Loading branch information
schuemie committed Apr 6, 2015
1 parent 810d914 commit 9521d24
Show file tree
Hide file tree
Showing 9 changed files with 270 additions and 1 deletion.
143 changes: 143 additions & 0 deletions .cproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.350870109">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.350870109" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.debug.350870109" name="Debug" parent="cdt.managedbuild.config.gnu.mingw.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.350870109." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.debug.2092341537" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.exe.debug.765697661" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.debug"/>
<builder buildPath="${workspace_loc:/SQLRender}/Debug" id="cdt.managedbuild.tool.gnu.builder.mingw.base.2107293468" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug.782897633" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1508428635" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1899215654" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
<tool command="g++ -m64" id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.1906183317" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug">
<option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.1370478975" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.1502426046" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.1221769967" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${env_var:R_HOME}\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${env_var:R_LIBRARY}\Rcpp\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${env_var:R_LIBRARY}\RInside\include&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.other.verbose.1037578147" name="Verbose (-v)" superClass="gnu.cpp.compiler.option.other.verbose" useByScannerDiscovery="false" value="false" valueType="boolean"/>
<option id="gnu.cpp.compiler.option.preprocessor.def.2125827854" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="ECLIPSE"/>
</option>
<option id="gnu.cpp.compiler.option.dialect.std.1867181405" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.c++11" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1622444260" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.2100678154" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.exe.debug.option.optimization.level.1248707560" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.1993227356" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1733167620" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.1891866729" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"/>
<tool command="g++ -m64 " id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug.215915828" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug">
<option id="gnu.cpp.link.option.userobjs.1251581149" name="Other objects" superClass="gnu.cpp.link.option.userobjs"/>
<option id="gnu.cpp.link.option.shared.1308850821" name="Shared (-shared)" superClass="gnu.cpp.link.option.shared" value="false" valueType="boolean"/>
<option id="gnu.cpp.link.option.libs.408653536" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="R"/>
<listOptionValue builtIn="false" value="Rcpp"/>
<listOptionValue builtIn="false" value="RInside"/>
</option>
<option id="gnu.cpp.link.option.paths.683108555" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${env_var:R_HOME}\bin\x64&quot;"/>
<listOptionValue builtIn="false" value="&quot;${env_var:R_LIBRARY}\Rcpp\libs\x64&quot;"/>
<listOptionValue builtIn="false" value="&quot;${env_var:R_LIBRARY}\RInside\libs\x64&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.549320629" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.release.1370637080">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.release.1370637080" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.release.1370637080" name="Release" parent="cdt.managedbuild.config.gnu.mingw.exe.release">
<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.release.1370637080." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.release.1168536325" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.release">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.exe.release.1711444560" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.release"/>
<builder buildPath="${workspace_loc:/SQLRender}/Release" id="cdt.managedbuild.tool.gnu.builder.mingw.base.1432080139" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.release.586070963" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.585962696" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1070420153" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release.381504557" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release">
<option id="gnu.cpp.compiler.mingw.exe.release.option.optimization.level.1158119234" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.mingw.exe.release.option.debugging.level.1655313599" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.767952571" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.1042730514" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.exe.release.option.optimization.level.1352049103" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.release.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.mingw.exe.release.option.debugging.level.1386426666" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1417753075" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release.1711173395" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.release.661490430" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1894466825" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="SQLRender.cdt.managedbuild.target.gnu.mingw.exe.539233143" name="Executable" projectType="cdt.managedbuild.target.gnu.mingw.exe"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.350870109;cdt.managedbuild.config.gnu.mingw.exe.debug.350870109.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.1906183317;cdt.managedbuild.tool.gnu.cpp.compiler.input.1622444260">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.350870109;cdt.managedbuild.config.gnu.mingw.exe.debug.350870109.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.2100678154;cdt.managedbuild.tool.gnu.c.compiler.input.1733167620">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.1370637080;cdt.managedbuild.config.gnu.mingw.exe.release.1370637080.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release.381504557;cdt.managedbuild.tool.gnu.cpp.compiler.input.767952571">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.1370637080;cdt.managedbuild.config.gnu.mingw.exe.release.1370637080.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.1042730514;cdt.managedbuild.tool.gnu.c.compiler.input.1417753075">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/SQLRender"/>
</configuration>
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/SQLRender"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cproject>
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@
# RStudio files
.Rproj.user/
.Rproj.user

# SqlRender
statement_*.sql
errorReport.txt

#C++ objects
src/*.o
src/*.so
src/*.dll
/Debug
standalone/build/*
27 changes: 27 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PatientLevelPrediction</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
13 changes: 13 additions & 0 deletions .settings/org.eclipse.cdt.managedbuilder.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
eclipse.preferences.version=1
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.350870109/CPATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.350870109/CPATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.350870109/CPLUS_INCLUDE_PATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.350870109/CPLUS_INCLUDE_PATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.350870109/C_INCLUDE_PATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.350870109/C_INCLUDE_PATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.350870109/append=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.350870109/appendContributed=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.350870109/LIBRARY_PATH/delimiter=;
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.350870109/LIBRARY_PATH/operation=remove
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.350870109/append=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.350870109/appendContributed=true
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ S3method(summary,cohortData)
S3method(summary,covariateData)
S3method(summary,outcomeData)
export(computeAuc)
export(computeAucFromDataFrames)
export(createCovariateSettings)
export(fitPredictiveModel)
export(getDbCohortData)
Expand Down
35 changes: 35 additions & 0 deletions R/Evaluate.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,41 @@ computeAuc <- function(prediction,
}
}

#' Compute the area under the ROC curve
#'
#' @details Computes the area under the ROC curve for the predicted probabilities, given the
#' true observed outcomes.
#'
#' @param prediction A vector with the predicted hazard rate.
#' @param status A vector with the status of 1 (event) or 0 (no event).
#' @param time Only for survival models: a vector with the time to event or censor (which ever comes first).
#' @param confidenceInterval Should 95 percebt confidence intervals be computed?
#' @param timePoint Only for survival models: time point when the AUC should be evaluated
#' @param modelType Type of model. Currently supported are "logistic" and "survival".
#'
#' @export
computeAucFromDataFrames <- function(prediction, status, time = NULL, confidenceInterval = FALSE, timePoint, modelType = "logistic"){
if (modelType == "survival" & confidenceInterval)
stop("Currently not supporting confidence intervals for survival models")

if (modelType == "survival"){
Surv.rsp <- Surv(time, status)
Surv.rsp.new <- Surv.rsp
if (missing(timePoint))
timePoint <- max(time[status == 1])
auc <- AUC.uno(Surv.rsp, Surv.rsp.new, prediction, timePoint)$auc
return(auc*auc)
} else {
if (confidenceInterval){
auc <- .Call('PatientLevelPrediction_aucWithCi', PACKAGE = 'PatientLevelPrediction', prediction, status)
return(data.frame(auc=auc[1],auc_lb95ci=auc[2],auc_lb95ci=auc[3]))
} else {
auc <- .Call('PatientLevelPrediction_auc', PACKAGE = 'PatientLevelPrediction', prediction, status)
return(auc)
}
}
}

#' Plot the calibration
#'
#' @details Create a plot showing the predicted probabilities and the observed fractions. Predictions
Expand Down
Loading

0 comments on commit 9521d24

Please sign in to comment.