# [R] crr question‏ in library(cmprsk)

Elan InP englishinparis at aim.com
Fri Oct 18 14:06:35 CEST 2013

```Hi all

I do not understand why I am getting the following error message. I am showing all my code this time. Can
anybody help me with this? Thanks in advance.

install.packages("cmprsk")
library(cmprsk)

ndim = 5

# two covariates standard normal variates
z1 = rnorm(ndim)
z2 = rnorm(ndim)

beta11 = beta12=0.5

p = 0.15

# baseline is modeled by modified logistic model
b1 = 1
c1 = 2
b2 = 2
c2 = 4

U = runif(ndim)
V = runif(ndim)

tmp=(1-(1-U)^{exp(-z1*beta11-z2*beta12)})/p
T = ifelse(tmp<1, c1+1/b1*log((tmp+exp(-b1*c1))/(1-tmp)),
c2+1/b2*log((V+exp(-b2*c2))/(1-V)))
epsilon = ifelse(tmp<1, 1, 2)
C = runif(ndim, 4,5)    # around 20% censored data
Y = ifelse(T<=C, T, C)
eta = ifelse(T<=C, epsilon, 0)

time = Y
event = eta

one.time = 3    # the time point that the predicted CIF is estimated
one.z1 = -1
one.z2 = 2        # the covariates values that the predicted CIF is
estimated

ftime<-T
fstatus<-eta
cov1<-cbind(z1,z2)

result1 <-crr(ftime, fstatus, cov1, failcode=1, cencode=0 )
one.pout1 = predict(result1,cov1,X=cbind(1,one.z1,one.z2))

predict.crr(result1,cov1,X=cbind(1,one.z1,one.z2))
Error: could not find function "predict.crr"

On 10/18/2013 7:32 AM, Andrews, Chris wrote:
> I don't get an error message.  However, I had to make up fstatus and all the rest because your example is not reproducible.  Please provide the list with more information and you'll likely get a more helpful answer from someone.
>
> -----Original Message-----
> From: Elan InP [mailto:elodie.gillain at gmail.com]
> Sent: Thursday, October 17, 2013 9:59 PM
> To: r-help at r-project.org
> Subject: [R] crr question‏ in library(cmprsk)
>
> Hi all
>
> I do not understand why I am getting the following error message. Can
> anybody help me with this? Thanks in advance.
>
> install.packages("cmprsk")
> library(cmprsk)
> result1 <-crr(ftime, fstatus, cov1, failcode=1, cencode=0 )
> one.pout1 = predict(result1,cov1,X=cbind(1,one.z1,one.z2))
>
> predict.crr(result1,cov1,X=cbind(1,one.z1,one.z2))
> Error: could not find function "predict.crr"
>
>
>
> 	[[alternative HTML version deleted]]
>
>
> **********************************************************
> Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues

```