Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about as_ped() #246

Open
meriops opened this issue Oct 7, 2024 · 0 comments
Open

Question about as_ped() #246

meriops opened this issue Oct 7, 2024 · 0 comments

Comments

@meriops
Copy link

meriops commented Oct 7, 2024

First, thank you for your work on pammtools. In preparation for analysis where I don't really know whether the time-varying covariates will have a concurrent or cumulative effect (ie both are possible, and I was planning on selecting the 'best' effect through AIC), I am trying to run the following code :

    ped_pbc2 <- as_ped(
      data = list(pbc, pbcseq),
      formula = Surv(time, status) ~ . +
        concurrent(bili, tz_var = "day", suffix = "concur") +
        concurrent(bili, tz_var = "day", lag = 10, suffix = "concurlag10") +
        cumulative(latency(day), bili, tz_var = "day", suffix = "cumul"),
      id = "id"
    )

Things seem to work as intended with each of the 'special' formula components taken individually, but when I run the code as above, I get the following message / error :

New names:
• `bili` -> `bili...11`
• `bili` -> `bili...12`
New names:
• `bili` -> `bili...14`
Error in `map()`:
ℹ In index: 1.
Caused by error in `if (col_vars[i] == func$latency_var) ...`:
! argument is of length zero
Run `rlang::last_trace()` to see where the error occurred.
  1. The initial comment about new names makes me think that the suffix argument is ignored... Indeed, this argument appears in some of the examples of the documentation website, but not in the function description / help page. Side note: this is also the case for the id argument in as_ped() ...

  2. More importantly, I don't really understand why this code doesn't work... I kind of have the impression that this is somewhat related to the suffix argument.... But I might as well misunderstand something completely and maybe my approach/intention here is simply wrong , and I would appreciate any pointer with respect to the best way to do this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant