Skip to content

Commit

Permalink
Bug fix for aft with left truncation
Browse files Browse the repository at this point in the history
  • Loading branch information
mclements committed Aug 9, 2024
1 parent 4c6ddf5 commit 26ed06a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/aft.R
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ aft <- function(formula, data, smooth.formula = NULL, df = 3,
warning("Design matrix for the acceleration factor is not full rank")
X <- X[, X.index, drop=FALSE]
XD0 <- X0 <- XD <- matrix(0,1,ncol(X))
X_list = list()
X_list <- X_list0 <- list()
gauss = gauss.quad(control$nNodes)
if (delayed && all(time0==0)) delayed <- FALSE # CAREFUL HERE: delayed redefined
if (tvc.integrated) {
Expand Down
9 changes: 9 additions & 0 deletions inst/working_code.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
## require(bbmle)
## }

## Bug report: aft with left truncation
library(rstpm2)
brcancer$start <- 0
fit <- aft(Surv(start, rectime,censrec==1)~hormon,data=brcancer,df=4) # now okay:)
brcancer$start <- 1
fit <- aft(Surv(start, rectime,censrec==1)~hormon,data=brcancer,df=4) # now okay:)

length(rstpm2:::lhs(Surv(start, rectime, censrec == 1) ~ hormon))

## test for predict(..., type="lpmatrixD")
library(rstpm2)
fit = aft(Surv(rectime,censrec==1)~hormon,data=brcancer)
Expand Down

0 comments on commit 26ed06a

Please sign in to comment.