Skip to content

flexsurvspline: optimization errors when using left-truncation for age at study entry #217

@jarbet

Description

@jarbet

Related to #110

I'm trying to use left-truncation to account for age at study entry, and use age as the underlying time-scale, as recommended here).

suppressPackageStartupMessages({
  library(survival)
  library(flexsurv)
})
packageVersion("flexsurv")
#> [1] '2.3.2'

pbc$start <- pbc$age
pbc$stop <- pbc$age + pbc$time / 365.25

fit <- flexsurvspline(
  Surv(start, stop, status == 2) ~ sex,
  data = pbc,
  k = 4
)
#> Error in optim(method = "BFGS", par = c(gamma0 = 0, gamma1 = 0, gamma2 = 0, : initial value in 'vmmin' is not finite

Created on 2026-03-09 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions