Re: [R] Efficient way to update a survival model

2019-08-30 Thread Frank S .
Chris, thank you for your elegant solution! Just one minor question: I wonder how to include within the loop of your solution the 10 models, that is, writing for (k in 1:10) so that you can get {Cox[[1]], ..., Cox[[10]]}. However, I'm aware that some change has to be done due to the fact that,

[R] [R-pkgs] New CRAN package: ipfr

2019-08-30 Thread Kyle Ward
This package implements a robust iterative proportional fitting algorithm, which is useful in survey expansion, matrix balancing, population synthesis, and other applications. For example, this package could can weight a survey of households to match known population characteristics like the

Re: [R] Efficient way to update a survival model

2019-08-30 Thread Andrews, Chris
The updated formula needs to have a different term rather than cos(k * v) every time. Here is one way to explicitly change the formula. library("survival") set.seed(1) v <- runif(nrow(pbc), min = 0, max = 2) Cox0 <- coxph(Surv(pbc$time,pbc$status == 2) ~ v, data = pbc) Cox <- vector("list",

Re: [R] Efficient way to update a survival model

2019-08-30 Thread Frank S .
Hi everyone, Vito, perhaps my previous mail was not clear. It is true that I used a loop, but the key point is that such a loop cannot compute the desired result. For example, for k = 3 the following loop Cox <- list() Cox[[1]] <- coxph(Surv(time,status == 2) ~ v + cos(v), data = pbc) for (k