[R] clm function in ordinal package: "Hessian is numerically singular"
Carlos Bautista León
carlosbautistaleon at gmail.com
Mon May 16 12:25:23 CEST 2016
Dear list,
I'm modeling ordinal data using the clm function from the ordinal package
in R. For that I have 4 variables, 2 ordinal and 2 continuous (O1, O2, C1,
C2).
O1 <- c(2,2,1,2,2,1,3,2,2,3,3,2,1,3,2,2,2)
O2 <- c(2,2,3,2,2,1,2,2,2,1,1,2,3,2,2,2,2)
C1 <- C(49,25,1000,19,61,700,25,375,35,46,105,437,3300,31,203,34,800)
C2 <- c(25350,25050,14925,25050,14325,16300,26425,22250,22250,44650,44650,21400,30125,25350,25050,14325,17525)
data <- data.frame (O1, O2, C1, C2)
data <- within(data, {
O1 <- factor ((O1), ordered =TRUE,
levels = c("1", "2", "3"))
O2 <- factor ((O2), ordered =TRUE,
levels = c("1", "2", "3"))})
In a first step I want to model O1 as response variable and O2, C1 and C2
as predictors (3 different models) and second, use O2 as response and O1,
C1 and C2 as predictors (another 3 different models).
m1 <- clm(O1 ~ O2, data = data)
m2 <- clm(O1 ~ C1, data = data)
m3 <- clm(O1 ~ log(C2), data = data)
m4 <- clm(O2 ~ O1, data = data)
m5 <- clm(O2 ~ C1, data = data)
m6 <- clm(O2 ~ log(C2), data = data)
As you can see all models run without problem except for the first one (m1)
which gives as a warning message:
(1) Hessian is numerically singular: parameters are not uniquely determined
In addition: Absolute convergence criterion was met, but relative criterion
was not met
and do not report any standard error or wald z test.
I do not have this problem when simulating data
data$x1 <- sample(c(1,2,3), 17, replace = TRUE)
What confuses me is that, unlike with m1 (O1 ~ O2), the model which uses O2
as response and O1 as predictor works perfectly fine. In addition I have
tried replacing some values in O1 and it happened that when substituting 1
by 2 or 3 I do not get any warning message and I obtain all the
coefficients of the model.
I made some research and it seems and this can be due to low representation
of certain values in the response, as well as to a small sample size. Is
that right or can it be a bug? Can someone help me please?
Thanks a lot!
Carlos Bautista
[[alternative HTML version deleted]]
More information about the R-help
mailing list