mediation icon indicating copy to clipboard operation
mediation copied to clipboard

Error in Surv(time, event) : cannot find object "time"

Open ShangziWang opened this issue 3 years ago • 1 comments

[Error in Surv(time, event) : cannot find object "time"] in survreg()

Here I am doing mediation analysis among X, Y, and m. Here model.m is linear model and model.y is survival model. The code is as follow:

model.m <- lm(m ~ X, data = data) model.y <- survreg(Surv(time, event) ~ X+m, data = data) mediation <- mediate(model.m, model.y, treat = "X", mediator = "m" , boot = T, outcome = "event")

However, error occurred as Error in Surv(time, event) : cannot find object "time.

ShangziWang avatar Aug 11 '21 08:08 ShangziWang