Last updated on 2026-10-24 12:51:45 CEST.
| Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
|---|---|---|---|---|---|---|
| r-devel-linux-x86_64-debian-clang | 8.1-1 | 43.42 | 306.30 | 349.72 | OK | |
| r-devel-linux-x86_64-debian-gcc | 8.1-1 | 30.64 | 176.27 | 206.91 | ERROR | |
| r-devel-linux-x86_64-fedora-clang | 8.1-1 | 34.00 | 231.41 | 265.41 | OK | |
| r-devel-linux-x86_64-fedora-gcc | 8.1-1 | 32.00 | 186.05 | 218.05 | OK | |
| r-devel-windows-x86_64 | 8.1-1 | 50.00 | 380.00 | 430.00 | OK | |
| r-patched-linux-x86_64 | 8.1-1 | 48.18 | 295.51 | 343.69 | OK | |
| r-release-linux-x86_64 | 8.1-1 | 40.39 | 296.95 | 337.34 | OK | |
| r-release-macos-arm64 | 8.1-1 | 11.00 | 58.00 | 69.00 | OK | |
| r-release-macos-x86_64 | 8.1-1 | 33.00 | 305.00 | 338.00 | OK | |
| r-release-windows-x86_64 | 8.1-1 | 54.00 | 311.00 | 365.00 | OK | |
| r-oldrel-macos-arm64 | 8.1-1 | 11.00 | 62.00 | 73.00 | OK | |
| r-oldrel-macos-x86_64 | 8.1-1 | 40.00 | 415.00 | 455.00 | OK | |
| r-oldrel-windows-x86_64 | 8.1-1 | 66.00 | 405.00 | 471.00 | OK |
Version: 8.1-1
Check: examples
Result: ERROR
Running examples in ‘rms-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: cph
> ### Title: Cox Proportional Hazards Model and Extensions
> ### Aliases: cph Survival.cph Quantile.cph Mean.cph
> ### Keywords: survival models nonparametric
>
> ### ** Examples
>
> # Simulate data from a population model in which the log hazard
> # function is linear in age and there is no age x sex interaction
>
> require(survival)
Loading required package: survival
> require(ggplot2)
Loading required package: ggplot2
> n <- 1000
> set.seed(731)
> age <- 50 + 12*rnorm(n)
> label(age) <- "Age"
> sex <- factor(sample(c('Male','Female'), n,
+ rep=TRUE, prob=c(.6, .4)))
> cens <- 15*runif(n)
> h <- .02*exp(.04*(age-50)+.8*(sex=='Female'))
> dt <- -log(runif(n))/h
> label(dt) <- 'Follow-up Time'
> e <- ifelse(dt <= cens,1,0)
> dt <- pmin(dt, cens)
> units(dt) <- "Year"
> dd <- datadist(age, sex)
> options(datadist='dd')
> S <- Surv(dt,e)
>
> f <- cph(S ~ rcs(age,4) + sex, x=TRUE, y=TRUE)
> cox.zph(f, "rank") # tests of PH
chisq df p
rcs(age, 4) 0.744 3 0.863
sex 2.859 1 0.091
GLOBAL 3.563 4 0.468
> anova(f)
Wald Statistics Response: S
Factor Chi-Square d.f. P
age 57.75 3 <.0001
Nonlinear 8.17 2 0.0168
sex 18.75 1 <.0001
TOTAL 75.63 4 <.0001
> ggplot(Predict(f, age, sex)) # plot age effect, 2 curves for 2 sexes
> survplot(f, sex) # time on x-axis, curves for x2
> res <- resid(f, "scaledsch")
> time <- as.numeric(dimnames(res)[[1]])
> z <- loess(res[,4] ~ time, span=0.50) # residuals for sex
> plot(time, fitted(z))
> lines(supsmu(time, res[,4]),lty=2)
> plot(cox.zph(f,"identity")) #Easier approach for last few lines
> # latex(f)
>
>
> f <- cph(S ~ age + strat(sex), surv=TRUE)
> g <- Survival(f) # g is a function
> g(seq(.1,1,by=.1), stratum="sex=Male", type="poly") #could use stratum=2
[1] 0.999 0.996 0.994 0.993 0.992 0.992 0.992 0.992 0.992 0.991
> med <- Quantile(f)
> plot(Predict(f, age, fun=function(x) med(lp=x))) #plot median survival
>
> # Fit a model that is quadratic in age, interacting with sex as strata
> # Compare standard errors of linear predictor values with those from
> # coxph
> # Use more stringent convergence criteria to match with coxph
>
> f <- cph(S ~ pol(age,2)*strat(sex), x=TRUE, eps=1e-9, iter.max=20)
Warning in coxph.control(eps = eps, toler.chol = tol, toler.inf = 1, iter.max = iter.max) :
For numerical accuracy, tolerance should be < eps
> coef(f)
age age^2 age * sex=Male age^2 * sex=Male
0.100744 -0.000548 -0.020831 0.000276
> se <- predict(f, se.fit=TRUE)$se.fit
> require(lattice)
Loading required package: lattice
> xyplot(se ~ age | sex, main='From cph')
> a <- c(30,50,70)
> comb <- data.frame(age=rep(a, each=2),
+ sex=rep(levels(sex), 3))
>
> p <- predict(f, comb, se.fit=TRUE)
> comb$yhat <- p$linear.predictors
> comb$se <- p$se.fit
> z <- qnorm(.975)
> comb$lower <- p$linear.predictors - z*p$se.fit
> comb$upper <- p$linear.predictors + z*p$se.fit
> comb
age sex yhat se lower upper
1 30 Female -0.8237 1.247 -3.268 1.621
2 30 Male -1.2000 0.677 -2.527 0.127
3 50 Female 0.3142 1.459 -2.545 3.174
4 50 Male -0.0368 0.943 -1.886 1.812
5 70 Female 1.0135 1.482 -1.891 3.918
6 70 Male 0.9088 0.911 -0.876 2.694
>
> age2 <- age^2
> f2 <- coxph(S ~ (age + age2)*strata(sex))
> coef(f2)
age age2 age:strata(sex)Male
0.100744 -0.000548 -0.020831
age2:strata(sex)Male
0.000276
> se <- predict(f2, se.fit=TRUE)$se.fit
Error in a$specials[[i]] : subscript out of bounds
Calls: predict -> predict.coxph -> delete.response -> off
Execution halted
Examples with CPU (user + system) or elapsed time > 5s
user system elapsed
contrast 5.115 0.098 6.158
Flavor: r-devel-linux-x86_64-debian-gcc