R Under development (unstable) (2024-03-16 r86144 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # This file is part of the standard setup for testthat. > # It is recommended that you do not modify it. > # > # Where should you do additional test configuration? > # Learn more about the roles of various files in: > # * https://r-pkgs.org/tests.html > # * https://testthat.r-lib.org/reference/test_package.html#special-files > > library(testthat) > library(QHScrnomo) Loading required package: rms Loading required package: Hmisc Attaching package: 'Hmisc' The following object is masked from 'package:testthat': describe The following objects are masked from 'package:base': format.pval, units > > # Run a basic model > dd <- datadist(prostate.dat) > options(datadist = "dd") > prostate.f <- cph(Surv(TIME_EVENT,EVENT_DOD == 1) ~ TX + rcs(PSA,3) + + BX_GLSN_CAT + CLIN_STG + rcs(AGE,3) + + RACE_AA, data = prostate.dat, + x = FALSE, y = TRUE, surv = TRUE, time.inc = 144) > prostate.crr <- crr.fit(prostate.f, cencode = 0, failcode = 1) > > # Fit some cumulative incidence curves > cum <- cmprsk::cuminc(prostate.dat$TIME_EVENT, prostate.dat$EVENT_DOD, cencode = 0) > cum2 <- cmprsk::cuminc(prostate.dat$TIME_EVENT, prostate.dat$EVENT_DOD, prostate.dat$TX, cencode = 0) > > test_check("QHScrnomo") Base failure probability by time = 10 is 0.07268982 0.30480861 * (TX = "PI") + 0.066323409 * (TX = "RP") - 0.05173739 * PSA + 0.00060026412 * max(PSA - 3.8, 0)**3 - 0.00075935137 * max(PSA - 6.335, 0)**3 + 0.00015908725 * max(PSA - 15.9, 0)**3 + 0.12553095 * (BX_GLSN_CAT = "2") + 0.63008736 * (BX_GLSN_CAT = "3") - 0.26475762 * (CLIN_STG = "T2") + 0.083704451 * (CLIN_STG = "T3") - 0.030615192 * AGE + 4.2897617e-05 * max(AGE - 53.318904, 0)**3 - 8.993847e-05 * max(AGE - 64.190411, 0)**3 + 4.7040853e-05 * max(AGE - 74.104384, 0)**3 - 0.25220729 * RACE_AA 1 2 1 2 1 2 [ FAIL 0 | WARN 0 | SKIP 0 | PASS 40 ] > > proc.time() user system elapsed 9.15 0.42 9.56