I am using survival analysis with several ordered categorical variables set up, and since relevel does not support specifying the reference category for ordered categorical variables:
'''r
Station.flow.type <- factor(Station.flow.type, levels = c(1, 2, 3),
labels = c("Small-scale ", "Medium-scale", "Large-scale "), ordered = TRUE)
Station.type <- factor(Station.type, levels = c(1, 2, 3, 4),
labels = c("one line only", " connecting two lines", " connecting three lines",
"connecting four lines"), ordered = TRUE)
Public.transport.usage <- factor(Public.transport.usage, levels = c(1,2,3),labels = c("Occasionale", "Daily", "Frequent"),
ordered = TRUE)
'''
So I can't interpret the results of the model:
coef exp(coef) se(coef) z Pr(>|z|)
Station.flow.type.L 3.858e-01 1.471e+00 2.582e-03 149.411 < 2e-16 ***
Station.flow.type.Q -1.413e-01 8.683e-01 1.763e-03 -80.129 < 2e-16 ***
Station.type.L -1.638e-01 8.489e-01 1.803e-02 -9.086 < 2e-16 ***
Station.type.Q -9.406e-02 9.102e-01 1.497e-02 -6.282 3.34e-10 ***
Station.type.C -2.443e-01 7.832e-01 1.110e-02 -22.020 < 2e-16 ***
Public.transport.usage.L 2.675e-01 1.307e+00 8.648e-03 30.931 < 2e-16 ***
Public.transport.usage.Q -1.532e-01 8.579e-01 5.231e-03 -29.296 < 2e-16 ***
What all does LQC refer to, I would appreciate any help!
There is some relevant discussion in this SO post: r - Interpretation of .L, .Q., .C, .4… for logistic regression - Stack Overflow
but you can be explicit and set whatever order you wish.
for example putting middle first then small then large like so
Station.flow.type <- factor(1:3,
levels = c(1, 2, 3),
labels = c("Small-scale ", "Medium-scale", "Large-scale "), ordered = TRUE
)
reordered_station_flow_type <- factor(Station.flow.type,
levels = c(
"Medium-scale",
"Small-scale ",
"Large-scale "
)
)
Station.flow.type
reordered_station_flow_type
Thanks to jrauser and nirgrahamuk for their replies, I benefited a lot and I also found the explanation related to the question: Better Contrasts for Ordinal Variables in R • Aaron Gullickson . Thanks again for your help!
This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.