Skip to content

Question about dotwhisker

2 messages · Dan Bolser

#
Hello,

I'm reading this and one part is confusing me (the most ;-)

library(dotwhisker)
library(broom)
library(dplyr)

m1 <- lm(mpg ~ wt + cyl + disp + gear, data = mtcars)

# Please compare:
dwplot(m1)
dwplot(tidy(m1))

Why is the dwplot of tidy(m1) so different from the dwplot of m1?

I had thought that tidy just gathers data from m1 and that that is what
dwplot is showing, but the latter shows results that are closer to what you
get from inspecting m1:

Coefficients:
(Intercept)           wt          cyl         disp         gear
  43.539847    -3.792867    -1.784296     0.006944    -0.490445

Sorry if I'm being stupid, but the latter looks right while the former
looks wrong (i.e. I can't work out what the former is actually plotting).


Many thanks,
Dan.
#
Sorry, forgot to link the actual vignette:
https://cran.r-project.org/web/packages/dotwhisker/vignettes/dotwhisker-vignette.html

In fact the vignette states:
dwplot(m1_df) #same as dwplot(m1)

where m1_df is m1_df <- tidy(m1)

They are not the same in either the vignette itself or on my computer.

I don't understand the part about "rescale the coefficients", but it seems
that that is now the default... Just visually at least...

If the plots in the vignette are auto-generated from code, then that would
explain why the discrepancy isn't mentioned in the text.
On Fri, 18 Dec 2020 at 13:47, Dan Bolser <dan.bolser at gmail.com> wrote: