strengejacke / sjlabelled

Working with Labelled Data in R

Home Page:https://strengejacke.github.io/sjlabelled

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to make sure that only the coefficient names - and not the terms - will be shown in the label

opened this issue · comments

Hi,

I've plotted a plot_model picking specific terms from the plot. However, when I plot it, it shows the coefficients names preceded by the terms names as you can see below.

levels(b4$sexo2)
[1] "fem" "masc"
levels(b4$raca2)
[1] "branca" "parda" "preta" "amarela" "indigena"
levels(b4$escol2)
[1] "universitario" "2º grau" "< 2º grau"
levels(b4$rendacat2)
[1] "3" "2" "1"

plot_model

I wanted only the coefficients names in the label, like in the document where you described how to plot estimates of regression models.

E.g. you shown how to keep only coefficients sex2, dep2 and dep3

plot_model(m1, terms = c("sex2", "dep2", "dep3"))

However, the plot axis show different labels from those specified. Instead of showing sex2, dep2 and dep3 it shows slightly dependent, moderately dependent and female.

e g

The names of the coefficients - i.e. what you get when you call summary(model) or coef(model) - for factors are variable name + level. You can change the labels for the y-axis using the axis.labels-argument from plot_model(), or label your data.

Thank you very much! It worked by using axis.labels = c( )