aalfons / robmed

Perform mediation analysis via a fast-and-robust bootstrap test, as well as various other methods
GNU General Public License v3.0
6 stars 0 forks source link

Drop unused factor levels in categorical variables #23

Open aalfons opened 2 years ago

aalfons commented 2 years ago

Unused factor levels in categorical (independent or control) variables should be dropped. Argument drop.unused.levels in function model.frame() controls this and should be set to TRUE.

aalfons commented 2 years ago

Likely this needs to be fixed in the default method of fit_mediation(), where non-numeric x variables and covariates are converted using model.matrix().