Ask Your Question

How can the names of the regressions be placed on the y-axis using coefplot?

asked 2021-05-26 11:00:00 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-07-03 09:00:00 +0000

woof gravatar image

The names of the regressions can be placed on the y-axis using the vertical option in coefplot() function in R. The vertical option specifies the position of the coefficients relative to the y-axis, and can take one of the following values:

  • "horizontal": for horizontal orientation
  • "vertical" (default): for vertical orientation

To place the names of the regressions on the y-axis, set vertical = "horizontal" in the coefplot() function. For example:

library(coefplot) # create example model data(mtcars) model <- lm(mpg ~ wt + hp + qsec, data = mtcars) # plot coefficients with names on y-axis coefplot(model, vertical = "horizontal", main = "Coefficients of model") 

This will create a plot of the coefficients with the names of the regressions on the y-axis, as shown below:

Note that if the names of the regressions are long, they may not fit on the y-axis and may overlap with other labels. In such cases, it may be necessary to adjust the size or orientation of the plot, or to shorten the names of the regressions.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer

Question Tools


Asked: 2021-05-26 11:00:00 +0000

Seen: 8 times

Last updated: Jul 03 '21