I am running an ordered logit model using the package: oglmx
After running the regression, I calculated the margins using: oglmx.margins. However, I cannot export this output to latex or word or excel. I have tried stargazer, export_summs, and broom. All these methods failed to work.
The codes that I have used.
b19_ologit_model_PCM<-oglmx(ABoards_decile ~ Caste_SC_ST+ten_decile+Annual_inc+Sex_Female, data=b19_PCM_nob,link="logit",
constantMEAN = FALSE, constantSD = FALSE,
delta=0,threshparam = NULL)
summary(b19_ologit_model_PCM)
b19_ologit_margins_PCM<-margins.oglmx(b19_ologit_model_PCM,ascontinuous = TRUE)
tidy(b19_ologit_margins_PCM)
Error: No tidy method for objects of class margins.oglmx
export_summs(b19_ologit_margins_PCM)
Error: No tidy method for objects of class margins.oglmx
stargazer(b19_ologit_margins_PCM,type = 'text', se=list(NULL))
% Error: Unrecognized object type.
Example of data set:
structure(list(b19_PCM_nob.Candidate_name_10th = structure(c(60L,
20L, 121L, 25L, 122L, 29L, 10L, 73L, 11L, 93L, 68L, 128L, 126L,
51L, 2L, 35L, 46L, 34L, 30L, 21L), .Label = c("A AZIZUDDIN",
"AARCHEE AMRIT NEWARE", "AARUSH SHUKLA", "AAYUSH SHUKLA", "AAYUSH TETE",
"AAYUSHI AGRAWAL", "ABHIJAY RATHOR", "ABHISHEK BURMAN", "ABHISHEK CHANDRAKAR",
"ABHISHRI JOSHI", "ADARSH SINGH", "ADHIKARLA SHRAVANI", "ADITI JHA",
"ADITI SAO", "ADITI TIWARI", "ADITYA RANJAN SINGH", "AIYUSHI GHOSH",
"AMAN KUMAR SAHU", "AMAN KUMAR SINGH", "AMAN SINGH", "AMRITA PADHI",
"ANANAYE DWIVEDI", "ANIKET VERMA", "ANJALI JAGNE", "ANUBHAV PRATAP SINGH",
"ARINDAM SIL", "AVINASH PATEL", "AYAAN AHMED", "AYUSH BISHT",
"AYUSH KUMAR YADAV", "B KIRTI", "CHETNA TIKARIHA", "CHIRAG SHRIVASTAVA",
"CHITRA SARKAR", "D VAMSIDHAR", "DEEPANSHU PAWAR", "DEVENDRA KUMAR SAHU",
"DEVESH SHUKLA", "DHARMESH JAIN", "DIKSHA DEWANGAN", "HARLEEN KAUR",
"HARSH CHAKRABORTY", "HARSH DIWAN", "HARSH SAHU", "HARSHVARDHAN SINGH RAJPUT",
"HEMANG VERMA", "HIMANSHU KUMAR", "HRIDAM PALWE", "JAY PATEL",
"JAYANT S ULLAS", "JITENDRA KUMAR SINGH", "K RITIKA", "KHUSHI SAHU",
"KHUSHI SONI", "KHYATI YADAV", "KRISHNA AGRAWAL", "KUNAL RAJURKAR",
"KUNAL SINGH", "LAKSHYA VASWANI", "MANAS GUPTA", "MAYANK GUPTA",
"MD MAROOF HASAN KHAN", "MOHAMMED AYAAN", "MOKSHA CHANDRAKAR",
"MORESHWAR SAHU", "MRUNAL WALIMBE", "MUSKAN NAG", "NAIVEDYA SONI",
"NAMAN DAVE", "NEHA ANN JACOB", "NIDHI CHANDRA", "NIKITA SAHU",
"NUPUR CHANDRAKAR", "P V S CHIRAG", "PALAK RATHI", "PANKAJ KUMAR SAHU",
"PIYUSH SAHU", "POORNIMA MISHRA", "PRACHI LOKHANDE", "PRAGYA SRIVASTAVA",
"PRIYAM MISHRA", "PRIYANKA TRIPATHY", "PRIYANSHU CHANDRAKAR",
"PRIYANSHU SINGH", "PRIYANSHU THAKUR", "PULKIT JAIN", "PUSHPRAJ GENDRE",
"R HARSH SAI KUMAR", "R VAISHNAVI SATVIKA", "RACHIT RATHI", "RAMAN DESHPANDE",
"REMAN KUMAR LAHARE", "RICHA PANDEY", "RIYA DHOL", "ROHAN SARNA",
"ROHIT JAISWAL", "RUPALI AGRAWAL", "SAURABH KUSHWAHA", "SHADAB ABDUL LATIF SHEIKH",
"SHAMBHAVI DWIVEDI", "SHARMIN ANSARI", "SHASHANK PILLAI", "SHRADDHA SINGH",
"SHRAJAN PANDEY", "SHREYA DEWANGAN", "SHRISTI SAHU", "SHRISTI TIWARI",
"SHUBHAM KR PATEL", "SHUBHASHISH BANERJEE", "SHUBHIKA SOLANKI",
"SNEHA GUPTA", "SRISHTI SHUKLA", "SUBHASHIS SAMAL", "SUMEET RANJAN MISHRA",
"SUVIGYA PANDEY", "SUYASH PATEL", "SWANAND SANGWAI", "TRISHA GUPTA",
"TUSHAR BHARTI", "TUSHAR JASWANI", "UJJWAL JAIN", "UJJWAL MITTAL",
"UTKARSH NASHINE", "VAIBHAV TEMBHURKAR", "VIPUL JAIN", "VIRENDRA KUMAR SINGH",
"VIVEK KUMAR PRAJAPATI", "VRUSHALI ASODKAR", "YACHANA CHOUDHARY",
"YASHASHVI MISHRA", "YASMEEN MAHILANG", "YATHARTH SINGH"), class = "factor"),
b19_PCM_nob.Sex_Female = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L,
0L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 1L), b19_PCM_nob.Caste_SC_ST = c(0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 1L, 0L, 0L), b19_PCM_nob.ten_decile = c(8L, 1L, 1L, 1L,
8L, 5L, 2L, 4L, 7L, 9L, 4L, 9L, 9L, 9L, 7L, 7L, 5L, 2L, 5L,
5L), b19_PCM_nob.ABoards_decile = c(9L, 1L, 6L, 2L, 10L,
9L, 4L, 3L, 10L, 10L, 3L, 8L, 8L, 6L, 1L, 8L, 3L, 6L, 3L,
4L)), row.names = c(NA, 20L), class = "data.frame")
Unfortunately, the
oglmx
does not appear to be supported by any of the main table-making softwares, or by the two main “extractor” packages (broom
andparameters
). Also, please note that thestargazer
package does not appear to be updated anymore, so it is unlikely to support these models in the near future.Thankfully, it is quite easy to create tables for such models using the
modelsummary
package (disclaimer: I am the author). To achieve this, all you need to do is create a function calledtidy.margins.oglmx()
which accepts a model object and returns a data frame with aterm
column to represet each parameter, and agroup
column to represent levels of the outcome variable. See here for detailed instructions:https://vincentarelbundock.github.io/modelsummary/articles/modelsummary.html#adding-new-models-part-i
Note that changing the
output
argument of themodelsummary
function will allow you to export to LaTeX, HTML, Word, and more.Here's an example with a somewhat modified model since your example was not directly replicable (missing variable):