jkropko / coxed

Duration-Based Quantities of Interest and Simulation Methods for the Cox Proportional Hazards Model
23 stars 6 forks source link

Problem with `mutate()` input `y` #8

Open jkropko opened 3 years ago

jkropko commented 3 years ago

Dear Mr. Harden, dear Mr. Kropko

I am working with your command sim.survdata( ) from the coxed package in R. I have just encountered a strange error involving the command mutate( ). You could find my code and the error message below.

It seems that sim.survdata does not work when I want to consider only one regressor with time-varying coefficients.

Do you have an idea how to fix this?

In any case, thank you for writing the command, it helps a lot.

R Code

simdata <- sim.survdata(N=100, T=100, type="tvbeta", xvars=1, beta=as.matrix(rnorm(50,0,1)), num.data.frames=1)

Error Message

Error: Problem with mutate() input y. x Input y can't be recycled to size 100. i Input y is lifetimes. i Input y must be size 100 or 1, not 5000. Run rlang::last_error() to see where the error occurred.

yellowbridge commented 3 years ago

Hi, jkropko, a couple of months ago, I got the same problem, and I had reviewed the source code to locate where the problem was. Please refer to the first issue, I hope the author to provide some possible soulution. Thanks a lot.