strengejacke / sjPlot

sjPlot - Data Visualization for Statistics in Social Science
https://strengejacke.github.io/sjPlot
609 stars 93 forks source link

Add support for clm / clmm (ordinal package) #292

Closed kevinmickey closed 6 years ago

kevinmickey commented 7 years ago

It would be nice to add support for clm / clmm (from the ordinal package).

> rs = ordinal::clmm(dv~iv+(1|subj),df)
> sjPlot::plot_model(rs,grid = FALSE,sort.est = "sort.all",y.offset = .4,type='re')
Error in UseMethod("family") : 
  no applicable method for 'family' applied to an object of class "clmm"

If there's a workaround, let me know!

strengejacke commented 7 years ago

What would be the transformed estimates, odds ratios? I have to find a way to cope with the multiple intercepts, and there are few standard methods (no family() nor predict()). Also, I have to write my own tidier, I guess.

kevinmickey commented 7 years ago

Thanks for the quick response, and for all your work on his package!

Yes, odds ratios. Sorry if this is dumb -- are the values in the random effects plots transformed?

Definitely not worth too much time on your end -- ordinal may be a dying package. It looks like clm does have predict, but not the mixed model clmm.

I tried rs = brms::brm(dv~iv+(1|subj)+(1|item),df,family='cumulative') with more success. It looks like the levels of different random factors (subj and item) get grouped together on the same plots, rather than separated like they do for lmer. There is active development at https://github.com/paul-buerkner/brms, so they may be able to help standardize the output on their end.

strengejacke commented 7 years ago

are the values in the random effects plots transformed?

Yes, but you can choose the linear scale by setting tranform = NULL (see also help file on this argument).

Definitely not worth too much time on your end -- ordinal may be a dying package

Maybe, but I just saw that MASS::polr is only supported for effect plots, not for simple forest plots. So I might find some time to implement both.

It looks like the levels of different random factors (subj and item) get grouped together on the same plots, rather than separated like they do for lmer.

Yes, that might be. I haven't tried many different models when implementing random effect plots for rstanarm and brmsfit objects. I'll look into this.

Do you have a reproducible example for the brms-model and/or the clmm-model?

kevinmickey commented 7 years ago

Do you have a reproducible example for the brms-model and/or the clmm-model?

library(ordinal)
library(sjPlot)
rs = clmm(rating~temp+contact+(1|bottle)+(1|judge),wine)
plot_model(rs,grid = FALSE,sort.est = "sort.all",y.offset = .4,type='re')
rs = brms::brm(rating~temp+contact+(1|bottle)+(1|judge),family='cumulative',wine)
plot_model(rs,grid = FALSE,sort.est = "sort.all",y.offset = .4,type='re')
strengejacke commented 7 years ago
strengejacke commented 6 years ago

Cumulative family for brms should work in the current dev-version.

strengejacke commented 6 years ago

Ok, clmm now supported, but for random effects, currently no CIs are shown. Any ideas how to get CIs from clmm-random effects?

JCruk commented 5 years ago

How do we pass clmm object?

tab_model(Mod_clmm) Error in UseMethod("model_parameters") : no applicable method for 'model_parameters' applied to an object of class "clmm"