ggPMX icon indicating copy to clipboard operation
ggPMX copied to clipboard

Feature request: Plot regressor as covariates

Open tmss1 opened this issue 2 years ago • 3 comments
trafficstars

Variables defined as "regressor" in the Monolix dataset, as needed by the structural model in Monolix, are no longer recognised as covariates in ggPMX and cannot be plotted for covariate evaluation from the controller.

It would be helpful if we could plot these "regressor" variables needed by Monolix in all covariate evaluation plots for model diagnostics.

tmss1 avatar Mar 29 '23 09:03 tmss1

You can use the option strats in the controller creation to specify additional stratification factors which are not covariates: strats: character extra stratification variables

baltcir1 avatar Mar 29 '23 10:03 baltcir1

Thanks @baltcir1, It would not just appear in standard covariate plots when using, e.g., pmx_plot_eta_cats() though. Do you have an example on how I can use these additional stratification factors (e.g., if I added strats = c("regressor1","regressor2") in the controller), how can I add them to the plot above and show them with other covariates?

tmss1 avatar Mar 30 '23 11:03 tmss1

Hi @tmss1,

indeed, it won't appear in pmx_plot_eta_cats(). You can try the following (force adding this regressor in cats):

my_cats = ctr %>% get_cats()
my_new_cats = c(my_cats, "my_regressor")
ctr %>% set_data(cats = my_new_cats)

If this doesn't work, as a workaround, you could add a column in Monolix that is a copy of your regressor column set as a categorical covariate.

Of course, all this applies also to the case where your regressor is a continuous variable.

baltcir1 avatar Mar 30 '23 14:03 baltcir1