-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Hi,
Let me know if what I am trying to do is simply not intended usage of ALASCA. Otherwise, here is my issue.
I was trying to get the effect plots of a models with a time component, two fixed effects to be plotted, and a random effect variable:
model <- ALASCA(ALASCA_tb,
formula = value ~ time*var1+ var2+ time:var2+ (1 | rndvar1),
effects = c("var1+ time:var1", "var2+ time:var2"),
method="LMM",
participant_column="rndvar1",
use_Rfast=F
)
When plotting the resulting model, I get this warning
Error in `[.data.table`(data_to_plot, , `:=`(group_data, do.call(paste, :
Some items of .SDcols are not column names: [donation_type]
model$splot$model$effect_list$terms correctly lists the terms for each effect, but the function model_loaded$splot$plot_effect_score will incorrectly try to include the grouping term unique to the second effect for plotting the first effect. I traced it down to this line in the plot_effect_score function
data_to_plot[, `:=`(group_data, do.call(paste, c(.SD,
sep = "-"))), .SDcols = self$model$effect_terms[-1]]
The .SDCols names are gotten from model$splot$model$effect_terms which contains all terms of all effects, [-1] then assumes there is only one grouping term to be dropped, that is the first column. Perhaps instead self$model$effect_list$terms[[effect_i]][-1] could be used to make sure only the time term is kept?