-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi Kris,
I continued to follow the tutorial after solving issue 2 and tested my data with
profile_vvo_3 <- setup_profile(model_lasso_3, treatments(exper_vvo_3), treatments(exper_vvo_3))
samples_vvo_3 <- list(
real = outcomes(exper_vvo_3),
fitted = outcomes(sample(model_lasso_3, profile = profile_vvo_3)),
altered = outcomes(sample(altered_lasso_3, profile = profile_vvo_3))
) |>
bind_rows(.id = "source") |>
bind_cols(treatment = rep(treatments(exper_vvo_3)$Diet_Type, 3)) |>
pivot_longer(direct$outcome) |>
mutate(name = factor(name, levels = unique(direct$outcome)))
then I got an error:
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'object' in selecting a method for function 'outcomes': object 'Female' not found
I checked the cran doc It seemed I could not add pretreatment to the profile directly, also :
> profile_vvo_3.1 <- setup_profile(
model_lasso_3,
treatments(exper_vvo_3),
treatments(exper_vvo_3),
pretreatments = pretreatments(exper_vvo_3) # Explicitly include covariates like "Female"
)
Error in setup_profile(model_lasso_3, treatments(exper_vvo_3), treatments(exper_vvo_3), :
unused argument (pretreatments = pretreatments(exper_vvo_3))
Here I attached the traceback() info for the first error:
> traceback()
20: h(simpleError(msg, call))
19: .handleSimpleError(function (cond)
.Internal(C_tryCatchHelper(addr, 1L, cond)), "object 'Female' not found",
base::quote(eval(predvars, data, env)))
18: eval(predvars, data, env)
17: eval(predvars, data, env)
16: model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels)
15: model.frame(Terms, newdata, na.action = na.action, xlev = object$xlevels)
14: predict.lm(fits[[i]], newdata = newdata, ...)
13: predict(fits[[i]], newdata = newdata, ...)
12: predict(fits[[i]], newdata = newdata, ...)
11: x@mediation@sampler(x@mediation@estimates, newdata = bind_cols(pretreatment,
profile@t_mediator[[i]]), indices = i, ...)
10: .local(x, size, ...)
9: sample(model_lasso_3, profile = profile_vvo_3)
8: sample(model_lasso_3, profile = profile_vvo_3)
7: outcomes(sample(model_lasso_3, profile = profile_vvo_3))
6: list2(...)
5: bind_rows(list(real = outcomes(exper_vvo_3), fitted = outcomes(sample(model_lasso_3,
profile = profile_vvo_3)), altered = outcomes(sample(altered_lasso_3,
profile = profile_vvo_3))), .id = "source")
4: list2(...)
3: bind_cols(bind_rows(list(real = outcomes(exper_vvo_3), fitted = outcomes(sample(model_lasso_3,
profile = profile_vvo_3)), altered = outcomes(sample(altered_lasso_3,
profile = profile_vvo_3))), .id = "source"), treatment = rep(treatments(exper_vvo_3)$Diet_Type,
3))
2: pivot_longer(bind_cols(bind_rows(list(real = outcomes(exper_vvo_3),
fitted = outcomes(sample(model_lasso_3, profile = profile_vvo_3)),
altered = outcomes(sample(altered_lasso_3, profile = profile_vvo_3))),
.id = "source"), treatment = rep(treatments(exper_vvo_3)$Diet_Type,
3)), direct$outcome)
1: mutate(pivot_longer(bind_cols(bind_rows(list(real = outcomes(exper_vvo_3),
fitted = outcomes(sample(model_lasso_3, profile = profile_vvo_3)),
altered = outcomes(sample(altered_lasso_3, profile = profile_vvo_3))),
.id = "source"), treatment = rep(treatments(exper_vvo_3)$Diet_Type,
3)), direct$outcome), name = factor(name, levels = unique(direct$outcome)))
Looking forward to hearing from you.
Yours sincerely,
Jiyan
Metadata
Metadata
Assignees
Labels
No labels