Closed IsadoraBM closed 3 years ago
Cropped out variable names on purpose. The only one that shows up in the blue is the single variable not overlapping from the pink model when adding ordered_vars = c() and stating the variables within dwplot instead of implementing the mutate%>%arrange workaround
@IsadoraBM Frankly, I'm not sure I understand what issue is in your description. The following case illustrates how order_var
works for multiple models. Everything looks fine. I'll close the issue for now since not bug is detected. But definitely reopen it if the problem still exists on your side with the latest version of dotwhisker
. A replicable example will be very helpful.
library(dotwhisker)
m1 <- lm(mpg ~ wt + cyl + disp + gear, data = mtcars)
m2 <- update(m1, . ~ . + hp) # add another predictor
m3 <- update(m2, . ~ . + am) # and another
x <- list(m1, m2, m3)
dwplot(x,
order_vars = c("am", "cyl", "disp", "gear", "hp", "wt"))
These variables are interval. When a factor variable is used, the variable estimate is no longer Variable but rather VariableLevel1, VariableLevel2. For example, run with iris using Species as a predictor you'll see order_vars doesn't work on "Species", it has to be "Speciessetosa", "Speciesversicolor" etc.
From: Yue Hu @.> Sent: Friday, July 16, 2021 8:20:41 PM To: fsolt/dotwhisker @.> Cc: Isadora Borges Monroy @.>; Mention @.> Subject: Re: [fsolt/dotwhisker] order_vars is incompatible with multiple model dwplot (#100)
@IsadoraBMhttps://github.com/IsadoraBM Frankly, I'm not sure I understand what issue is in your description. The following case illustrates how order_var works for multiple models. Everything looks fine. I'll close the issue for now since not bug is detected. But definitely reopen it if the problem still exists on your side with the latest version of dotwhisker. A replicable example will be very helpful.
library(dotwhisker)
m1 <- lm(mpg ~ wt + cyl + disp + gear, data = mtcars) m2 <- update(m1, . ~ . + hp) # add another predictor m3 <- update(m2, . ~ . + am) # and another
x <- list(m1, m2, m3)
dwplot(x, order_vars = c("am", "cyl", "disp", "gear", "hp", "wt"))
[image]https://user-images.githubusercontent.com/6463211/126019498-070e2891-cd7d-4bd8-9248-5ad1bb788e2a.png
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/fsolt/dotwhisker/issues/100#issuecomment-881782323, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGNA6CM5FRLUA4LMEUEIOHLTYDEFTANCNFSM4Y7372SA.
If two models (A & B) share the same variables (e.g. 10) + and B has an additional variable. order_vars = c(...) output shows only the dwplot for all variables A and the the one different B variable. So, although reordering works 10/11 of B's variables are missing from the graph. If I remove order_vars the output is restored, though in disorder. I use the same variable terminology as the vignettes for reproducibility Workaround: run this first two_models %<>% #You'll need library(magrittr) or assign to itself [boring] mutate(term = factor(term, levels = ordered_vars)) %>% arrange(term)
then dwplot() as usual