jkropko / coxed

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

sim.survdata mu creates wrong covariates matrix #15

Open dddomiko opened 3 years ago

dddomiko commented 3 years ago

Hi jkropko,

i tried to simulate 3 covariates with differents mean values but it kept mixing up the 3 covariates.

df <- sim.survdata(N = 10, T = 110, type = "none", num.data.frames = 1, xvars = 3, mu = c(0,5,100), sd = 0, censor = 0.1)

head(df$data) X1 X2 X3 y failed 1 0 5 100 1 TRUE 2 5 100 0 110 TRUE 3 100 0 5 17 FALSE 4 0 5 100 1 TRUE 5 5 100 0 110 TRUE 6 100 0 5 14 TRUE `

I assume the reason for this bug is the missing byrow = TRUE parameter in the matrix() function in generate.lm().

Cheers dddomiko