Running examples in 'riskRegression-Ex.R' failed
The error most likely occurred in:

> ### Name: predictRisk
> ### Title: Extrating predicting risks from regression models
> ### Aliases: predictRisk predictRisk.CauseSpecificCox
> ###   predictRisk.riskRegression predictRisk.FGR predictRisk.prodlim
> ###   predictRisk.rfsrc predictRisk.aalen predictRisk.ARR
> ###   predictRisk.cox.aalen predictRisk.coxph predictRisk.cph
> ###   predictRisk.default predictRisk.matrix predictRisk.pecCtree
> ###   predictRisk.pecCforest predictRisk.psm predictRisk.selectCox
> ###   predictRisk.survfit predictRisk.randomForest predictRisk.lrm
> ###   predictRisk.glm predictRisk.rpart predictRisk.gbm
> ###   predictRisk.flexsurvreg predictRisk.double predictRisk.integer
> ###   predictRisk.factor predictRisk.numeric predictRisk.formula
> ###   predictRisk.BinaryTree predictRisk.coxphTD predictRisk.CSCTD
> ###   predictRisk.coxph.penal predictRisk.ranger predictRisk.penfitS3
> ###   predictRisk.SuperPredictor predictRisk.hal9001
> ###   predictRisk.singleEventCB predictRisk.wglm
> ### Keywords: survival
> 
> ### ** Examples
> 
> ## binary outcome
> library(rms)
Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, units

Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve

> set.seed(7)
> d <- sampleData(80,outcome="binary")
> nd <- sampleData(80,outcome="binary")
> fit <- lrm(Y~X1+X8,data=d)
> predictRisk(fit,newdata=nd)
 [1] 0.7339412 0.5205004 0.6501073 0.5979307 0.5552337 0.6813442 0.5138679
 [8] 0.4869184 0.5723498 0.7074138 0.4503456 0.6303146 0.6940030 0.7019831
[15] 0.7304874 0.5405902 0.6450002 0.6896565 0.6689911 0.6865119 0.7344731
[22] 0.6689586 0.6906598 0.6615316 0.6682134 0.7072245 0.5725908 0.6725140
[29] 0.7493084 0.5723684 0.5466048 0.5498836 0.6665991 0.4635920 0.6969143
[36] 0.5879416 0.5341623 0.6023531 0.5320208 0.6121940 0.5766031 0.4807605
[43] 0.7727554 0.5650180 0.5466259 0.6760755 0.6716273 0.6953790 0.6627699
[50] 0.6865030 0.7738892 0.5867579 0.7673772 0.5591252 0.6120579 0.7014891
[57] 0.5616479 0.6084543 0.5823368 0.4629641 0.5386492 0.7027465 0.6637092
[64] 0.6194466 0.4777845 0.4645041 0.5229923 0.5819439 0.5879641 0.5579212
[71] 0.6642978 0.5665127 0.4391573 0.4995590 0.6802095 0.5770284 0.5952840
[78] 0.5303929 0.5633104 0.7699667
> ## Not run: 
> ##D library(SuperLearner)
> ##D set.seed(1)
> ##D sl = SuperLearner(Y = d$Y, X = d[,-1], family = binomial(),
> ##D       SL.library = c("SL.mean", "SL.glmnet", "SL.randomForest"))
> ## End(Not run)
> 
> ## survival outcome
> # generate survival data
> library(prodlim)
> set.seed(100)
> d <- sampleData(100,outcome="survival")
> d[,X1:=as.numeric(as.character(X1))]
> d[,X2:=as.numeric(as.character(X2))]
> # then fit a Cox model
> library(rms)
> cphmodel <- cph(Surv(time,event)~X1+X2,data=d,surv=TRUE,x=TRUE,y=TRUE)
> # or via survival
> library(survival)
> coxphmodel <- coxph(Surv(time,event)~X1+X2,data=d,x=TRUE,y=TRUE)
> 
> # Extract predicted survival probabilities 
> # at selected time-points:
> ttt <- quantile(d$time)
> # for selected predictor values:
> ndat <- data.frame(X1=c(0.25,0.25,-0.05,0.05),X2=c(0,1,0,1))
> # as follows
> predictRisk(cphmodel,newdata=ndat,times=ttt)
            [,1]      [,2]      [,3]      [,4]      [,5]
[1,] 0.010423552 0.2498546 0.4661259 0.6749391 0.9490180
[2,] 0.011569784 0.2733328 0.5019288 0.7129324 0.9633185
[3,] 0.007190205 0.1796201 0.3509290 0.5387894 0.8712277
[4,] 0.009034264 0.2204172 0.4193263 0.6221600 0.9240581
> predictRisk(coxphmodel,newdata=ndat,times=ttt)
            [,1]      [,2]      [,3]      [,4]      [,5]
[1,] 0.010423555 0.2498546 0.4661259 0.6749389 0.9490178
[2,] 0.011569787 0.2733328 0.5019287 0.7129322 0.9633183
[3,] 0.007190219 0.1796204 0.3509294 0.5387898 0.8712279
[4,] 0.009034276 0.2204174 0.4193266 0.6221602 0.9240581
> 
> # stratified cox model
> sfit <- coxph(Surv(time,event)~strata(X1)+X2,data=d,x=TRUE,y=TRUE)
> predictRisk(sfit,newdata=d[1:3,],times=c(1,3,5,10))
           [,1]     [,2]      [,3]     [,4]
[1,] 0.07654315 0.281073 0.4322176 0.689776
[2,] 0.07654315 0.281073 0.4322176 0.689776
[3,] 0.07654315 0.281073 0.4322176 0.689776
> 
> ## simulate learning and validation data
> set.seed(10)
> learndat <- sampleData(100,outcome="survival")
> valdat <- sampleData(100,outcome="survival")
> ## use the learning data to fit a Cox model
> library(survival)
> fitCox <- coxph(Surv(time,event)~X1+X2,data=learndat,x=TRUE,y=TRUE)
> ## suppose we want to predict the survival probabilities for all subjects
> ## in the validation data at the following time points:
> ## 0, 12, 24, 36, 48, 60
> psurv <- predictRisk(fitCox,newdata=valdat,times=seq(0,60,12))
> ## This is a matrix with event probabilities (1-survival)
> ## one column for each of the 5 time points
> ## one row for each validation set individual
> 
> if (require("randomForestSRC",quietly=TRUE)){
+ # Do the same for a randomSurvivalForest model
+ library(randomForestSRC)
+ rsfmodel <- rfsrc(Surv(time,event)~X1+X2,data=learndat)
+ prsfsurv=predictRisk(rsfmodel,newdata=valdat,times=seq(0,60,12))
+ plot(psurv,prsfsurv)
+ }

 randomForestSRC 3.1.1 
 
 Type rfsrc.news() to see new features, changes, and bug fixes. 
 


Attaching package: 'randomForestSRC'

The following object is masked from 'package:Hmisc':

    impute


RF-SRC
RF-SRC:  *** ERROR *** 
RF-SRC:  Numerical Recipes Run-Time Error:
RF-SRC:  
  Allocation Failure in gblock().
RF-SRC:  Please Contact Technical Support.<simpleError in doTryCatch(return(expr), name, parentenv, handler): 
RF-SRC:  The application will now exit.
>
Error in rfsrc(Surv(time, event) ~ X1 + X2, data = learndat) : 
.mo
Error: internal compression error -4 in PDF_endpage
Fatal error: error during cleanup