I want to output a plot for the average marginal effect returned from the margins package. The variables are on the x axis but they are in the incorrect order and all variable names are not displayed. I would like to display all variable names in the correct order and rotate 90 degrees. This is my code:
margins_logit <- margins(LOGIT, variables=c("AGE", "AGE_SQRD", "LOGINCOME", "LOGINCOME_SQRD", "LOGSPEND", "LOGSPEND_SQRD"))
categories <- c(
"AGE",
"AGE_SQRD",
"LOGINCOME",
"LOGINCOME_SQRD",
"LOGSPEND",
"LOGSPEND_SQRD"
)
plot(margins_var, main="", xlab ="", xaxt='n', ann=TRUE)
axis(1, at=1:6, labels=categories, las = 2, cex.axis = 0.8)
I followed this: Remove plot axis values but it does not seem to work for me.
Many thanks!
Pontus