1

I'm plotting the effects of ordered logistic regression using sjplot plot_model function.

The code for fitting the model:

mult_4_rank_best <- polr(SpRank ~ RodentRank + SpName + day_start_scale + Lat_scale +
                           Lon2_scale + Lon_scale + RodentRank:SpName + 
                           day_start_scale:SpName + Lon2_scale:SpName + 
                           Lon_scale:SpName + RodentRank:SpName:day_start_scale, 
                         data = data_mult,
                         na.action = na.pass, 
                         Hess = TRUE)

Despite there are a lot of predictors, I want to see the effects of Rodent Rank and SpName on the outcome and use this code:

plot_model(mult_4_rank_best, type = "eff", terms = c("RodentRank", "SpName"))

Despite the fact that the variables in the dataset were ordered that way before fitting the model

data_mult$RodentRank <- factor(data_mult$RodentRank, 
                               levels = c("low", "average", "high"), 
                               ordered=TRUE)

I keep getting an outcome picture where the levels of RodentRank are in alphabetic order. The order.terms = c() does not help.

I could not google the answer to this problem. If somebody has a clue of how to manage with it I would be very grateful.

Z.Lin
  • 28,055
  • 6
  • 54
  • 94
  • What package is `plot_model` from? Where would one find the dataset `data_mult`? If you make your problem [reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) you'll have higher chances of getting useful help. Otherwise all we can do is speculate. – Z.Lin Apr 22 '19 at 14:47
  • I am sorry, I am new to the forum and do not know the rules well so far. I have mentioned in the text above that **plot_model** function belongs to the package **sjPlot**. But I have not found the way to adjust the order in which the factorial predictor appears on the graph in the package documentation, though I read it very carefully. Do you consider it makes sense to download my dataset to a cloud and put a link here? But to reproduce all the analysis one would have to use all my code, that is not very short. – Olga Koulikova Apr 23 '19 at 23:18
  • Please read the link I included in my previous comment. That would be a good starting point as far as rules go. You do not have to share *all* your data if a smaller subset is able to represent your problem. We generally do not like linked data, because (no offence) no one has reason to trust a random link posted by a stranger. There's also the issue of link rot, where someone else with a similar problem two years down the road may not be able to understand the problem because the data's no longer available, making what could have been a good question useless for the community in the long run. – Z.Lin Apr 24 '19 at 02:21
  • See a relevant answer: https://stackoverflow.com/questions/76531839/how-can-i-change-the-order-of-facets-in-plot-model-without-changing-the-underlyi/76532082#76532082 – Pablo Bernabeu Jun 24 '23 at 10:53

0 Answers0