Skip to content

Question: Arguments for z in simEventData() #9

Closed Answered by wenjie2wang
tobiasmuetze asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for the question. I do not have a good solution to it now. But the simEventData() is a simple wrapper function for the simEvent() function. Thus, a quick workaround can be as follows:

library(reda)

zFun3 <- function(time, a, b) cbind(time / 10 + a, as.numeric(time > b))

## workaround
set.seed(123)
a <- seq(0.1, by = 0.1, length.out = 3)
helper <- reda:::simEvent2data
simDat <- lapply(seq_along(a), function(i) {
    res <- simEvent(z = zFun3,
                    zCoef = c(- 0.1, 0.5),
                    arguments = list(
                        z = list(a = a[i],
                                 b = quote(runif(1, 1, 3)))))
    helper(ID = i, res)
}) |> do.call(rbind, args = _)

…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tobiasmuetze
Comment options

Answer selected by tobiasmuetze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #8 on April 15, 2023 02:25.