Questions tagged [coefplot]

59 questions
2
votes
1 answer

Change colors of select lines in ggplot2 coefficient plot in R

I would like to change the color of coefficient lines based on whether the point estimate is negative or positive in a ggplot2 coefficient plot in R. For example: require(coefplot) set.seed(123) dat <- data.frame(x = rnorm(100), z = rnorm(100)) mod1…
coding_heart
  • 1,245
  • 3
  • 25
  • 46
2
votes
1 answer

Subset of predictors using coefplot()

I'd like to do a plot of coefficients using coefplot() that only takes into account a subset of the predictors that I'm using. For example, if you have the code y1 <- rnorm(1000,50,23) x1 <- rnorm(1000,50,2) x2 <- rbinom(1000,1,prob=0.63) x3…
Tom Roth
  • 1,954
  • 17
  • 25
2
votes
1 answer

In Stata, how can I group coefplot's means across categorical variable?

I'm working with coefplot command (source, docs) in Stata plotting means of continuous variable over cateories. Small reporoducible example: sysuse auto, clear drop if rep78 < 3 la de rep78 3 "Three" 4 "Four" 5 "Five" la val rep78 rep78 mean mpg if…
radek
  • 7,240
  • 8
  • 58
  • 83
1
vote
0 answers

drop() option not working in coefplot package in Stata

In Stata I am trying to only keep specific variables in a coefficient plot, and I am using the drop() option but it is not working well although it is not producing any errors. coefplot is a community-contributed command, and here is more…
1
vote
1 answer

How to label y axis in coefplot?

How do I label/rename the variables on y axis? sysuse auto, clear regress price mpg trunk length turn if foreign==0 estimates store Option1 regress price mpg trunk length turn if foreign==1 estimates store Option2 coefplot Option1 Option2,…
Quinn
  • 9
  • 6
1
vote
2 answers

Separate coefficients from lm() and plot next to each other

I'm running a simple lm() regression that returns 4 coefficients. I would like to plot them two by two (next to each other, with different colours), as if I would have run two models giving two coefficients each. Minimal example: Y <- runif(100, 0,…
jkortner
  • 549
  • 2
  • 8
  • 23
1
vote
1 answer

fixest::iplot(), dropping some factors

I am using fixest (version 0.9.0), and I want to omit a numerical factor in the plot of the fixed effects generated by iplot(). library(fixest) reg1 <- feols(mpg ~ disp + i(carb, ref = 8), data = mtcars) fdict <- c("2" = "two", "3" =…
roussanoff
  • 319
  • 2
  • 7
1
vote
1 answer

manually order coefficients in coefplot

I would like to manually sort the coefficients in a coefplot. Previous questions only achieve ordering by (decreased) magnitude, which is not what I want. Consider the below example: library(coefplot) data(tips, package = "reshape2") mod1 <- lm(tip…
Ivo
  • 3,890
  • 5
  • 22
  • 53
1
vote
1 answer

Plot specific fixed-effect variable with multiple outcomes using coefplot

I run a regression with a fixed-effect that has multiple outcomes. I want to only plot that fixed-effect variable. I don't like the way coefplot does the ticks and labels. Let me give an example. sysuse auto reg price i.rep78 coefplot, vertical…
FooBar
  • 15,724
  • 19
  • 82
  • 171
1
vote
0 answers

How to set title font size in coefplot::coefplot.default()?

Using the library(coefplot), the following code creates a coefficient plot library(dplyr) library(coefplot) set.seed(123) x1 <- sample(1:8,10000,replace=TRUE) x2 <- sample(1:6,10000,replace=TRUE) x3 <- sample(1:7,10000,replace=TRUE) y <-…
Ivo
  • 3,890
  • 5
  • 22
  • 53
1
vote
1 answer

Coefplot for a chi square distribution

I was told to do a coefplot in R to visualise my data better. Therefore i first did a chi square test. and after i put my data into a table it looked like this: 1 2 3 5 6 5_min_blank 11 21 18 19 8 Boldstyle …
Jessi
  • 25
  • 1
  • 4
1
vote
0 answers

Plotting multilevel model coefficients in R

I am fitting a 2-level model in R using lme4 for a dataset with multiple election surveys. Im using household income by quintile (ordinal, 5 categories) to predict an outcome variable on the individual level, with individuals nested in survey years.…
roeljb
  • 11
  • 1
1
vote
1 answer

Different colors for coefficients in the same model with coefplot

I work with the community-contributed command coefplot to plot regression coefficients for a categorical variable. My regression model is a simple linear model which has a categorical variable with 7 types of cities as the independent variable and…
ggg
  • 73
  • 1
  • 7
1
vote
0 answers

subset one predictor coefplot() r

I would like to display the confidence interval for a single predictor with coefplot() or to change the scale of the x-axis to logarithmic. I run fit_tripadvisor <- lm(price ~ bedrooms + bathrooms + accommodates + shared + private +…
Stephen Kaiser
  • 113
  • 1
  • 7
1
vote
1 answer

order the coefficients by magnitude in multiplot

Previous question asked how the coefficients can be plotted in coefplot in descending order. The answer was to include sort = 'magnitude' However, I then discovered that this method does not work when plotting multiple models using…
invictus
  • 1,821
  • 3
  • 25
  • 30