How to analyse job satisfaction based on Likert 5 point rating scale with OLR in R ?

Hi All,
I would like to ask for advice on how to perform Ordinal Logistic Regression in R using my created below dataframe:

   My_OLR_dataframe <- structure(list(ID = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
13, 14, 15, 16, 17, 18, 19, 20), Group = c(1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2), Question_1 = c(4, 
2, 3, 4, 1, 1, 2, 4, 4, 3, 2, 4, 1, 2, 3, 5, 3, 4, 2, 1), Question_2 = c(2, 
4, 4, 1, 3, 2, 2, 4, 1, 3, 2, 5, 5, 3, 4, 1, 1, 2, 3, 2), Question_3 = c(2, 
3, 1, 5, 5, 1, 1, 2, 5, 2, 1, 1, 4, 2, 5, 1, 3, 3, 4, 4), Question_4 = c(2, 
1, 3, 3, 5, 4, 5, 5, 1, 3, 4, 1, 3, 5, 2, 4, 3, 1, 2, 1), Question_5 = c(4, 
3, 4, 1, 4, 4, 3, 2, 4, 1, 1, 1, 4, 4, 3, 3, 3, 4, 1, 3), Question_6 = c(5, 
2, 1, 4, 1, 2, 2, 2, 1, 2, 1, 4, 2, 4, 3, 4, 5, 3, 5, 1), Question_7 = c(1, 
5, 4, 2, 1, 4, 2, 4, 3, 2, 2, 3, 3, 4, 4, 3, 4, 4, 4, 1), Question_8 = c(4, 
1, 1, 1, 1, 4, 2, 1, 5, 2, 3, 4, 3, 1, 2, 2, 5, 4, 1, 2), Question_9 = c(2, 
3, 1, 4, 4, 3, 5, 4, 1, 3, 2, 1, 5, 3, 3, 4, 1, 1, 1, 5), Question_10 = c(1, 
2, 4, 4, 4, 3, 1, 2, 3, 1, 3, 2, 2, 2, 3, 3, 3, 5, 3, 3), Question_11 = c(3, 
1, 3, 3, 5, 4, 2, 4, 1, 4, 5, 4, 1, 2, 2, 3, 2, 1, 2, 3), Question_12 = c(1, 
1, 1, 5, 5, 3, 3, 3, 2, 3, 4, 4, 4, 1, 3, 1, 1, 2, 2, 2), Question_13 = c(2, 
5, 5, 1, 1, 3, 1, 4, 5, 1, 2, 4, 1, 3, 2, 5, 2, 5, 5, 5), Question_14 = c(4, 
1, 4, 1, 3, 1, 5, 4, 3, 1, 3, 4, 1, 4, 5, 3, 1, 4, 2, 1), Question_15 = c(2, 
4, 1, 3, 1, 2, 2, 3, 3, 1, 5, 2, 3, 5, 5, 2, 2, 1, 2, 3)), row.names = c(NA, 
-20L), class = c("tbl_df", "tbl", "data.frame"))
> aaa <- structure(list(ID = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
+ 13, 14, 15, 16, 17, 18, 19, 20), Group = c(1, 1, 1, 1, 1, 1, 
+ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2), Question_1 = c(4, 
+ 2, 3, 4, 1, 1, 2, 4, 4, 3, 2, 4, 1, 2, 3, 5, 3, 4, 2, 1), Question_2 = c(2, 
+ 4, 4, 1, 3, 2, 2, 4, 1, 3, 2, 5, 5, 3, 4, 1, 1, 2, 3, 2), Question_3 = c(2, 
+ 3, 1, 5, 5, 1, 1, 2, 5, 2, 1, 1, 4, 2, 5, 1, 3, 3, 4, 4), Question_4 = c(2, 
+ 1, 3, 3, 5, 4, 5, 5, 1, 3, 4, 1, 3, 5, 2, 4, 3, 1, 2, 1), Question_5 = c(4, 
+ 3, 4, 1, 4, 4, 3, 2, 4, 1, 1, 1, 4, 4, 3, 3, 3, 4, 1, 3), Question_6 = c(5, 
+ 2, 1, 4, 1, 2, 2, 2, 1, 2, 1, 4, 2, 4, 3, 4, 5, 3, 5, 1), Question_7 = c(1, 
+ 5, 4, 2, 1, 4, 2, 4, 3, 2, 2, 3, 3, 4, 4, 3, 4, 4, 4, 1), Question_8 = c(4, 
+ 1, 1, 1, 1, 4, 2, 1, 5, 2, 3, 4, 3, 1, 2, 2, 5, 4, 1, 2), Question_9 = c(2, 
+ 3, 1, 4, 4, 3, 5, 4, 1, 3, 2, 1, 5, 3, 3, 4, 1, 1, 1, 5), Question_10 = c(1, 
+ 2, 4, 4, 4, 3, 1, 2, 3, 1, 3, 2, 2, 2, 3, 3, 3, 5, 3, 3), Question_11 = c(3, 
+ 1, 3, 3, 5, 4, 2, 4, 1, 4, 5, 4, 1, 2, 2, 3, 2, 1, 2, 3), Question_12 = c(1, 
+ 1, 1, 5, 5, 3, 3, 3, 2, 3, 4, 4, 4, 1, 3, 1, 1, 2, 2, 2), Question_13 = c(2, 
+ 5, 5, 1, 1, 3, 1, 4, 5, 1, 2, 4, 1, 3, 2, 5, 2, 5, 5, 5), Question_14 = c(4, 
+ 1, 4, 1, 3, 1, 5, 4, 3, 1, 3, 4, 1, 4, 5, 3, 1, 4, 2, 1), Question_15 = c(2, 
+ 4, 1, 3, 1, 2, 2, 3, 3, 1, 5, 2, 3, 5, 5, 2, 2, 1, 2, 3)), row.names = c(NA, 
+ -20L), class = c("tbl_df", "tbl", "data.frame"))

which (partially) presents in View() like this:

I have two groups to compare: 1 and 2 - and each participant answered 15 questions based on Likert 5 item data (measured from 1 to 5).
These go as follows: 1=very bad, 2=bad, 3=neutral, 4=good, 5=very good.
I have read in many places that OLR would be good choice.
How to get it done in R ?
Any help will be greatly appreciated.
Thanks.

There is a function called polr in the MASS package that does ordered logistic regression. There is a blog post here and a tutorial here that discuss using the polr function.

Thank you, @FJCC ,
I have read what your links provided and I know MASS and polr function, but still
struggle how to start and use them in my particular example.

You say you want to compare groups 1 and 2. Does that mean that for each question you want to determine if the responses are different between the two groups? With five levels and about 10 responses per question it will be difficult to see a difference. In any case, code like

MASS::polr(factor(Question_1) ~ Group, data = My_OLR_dataframe)

might be what you want but bear in mind that I have never used the polr() function.

Thank you very much indeed @FJCC,
additional small question:
How can I change a layout of my dataframe to look like this:

I tried with this:

library(reshape2)
melt(My_OLR_dataframe, id.vars = c("ID", "Group"))

but this is not giving me what I want. So basically I want a values from my first dataframe to become a column names and obviously to have all frequency (sum of occurences of indyvidual Likert responses) in a cells in my new dataframe. I hope this make sense. I feel that I should use mutate() and case_when() function somehow.

This is a different question, we like to keep things tidy around here, so please ask it on a new topic, providing a relevant reproducible example for it.

Hi @andresrcs,
According to your suggestion I have done it already.
regards.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.