[R] clm function in ordinal package: "Hessian is numerically singular"

Michael Dewey lists at dewey.myzen.co.uk
Mon May 16 12:48:15 CEST 2016


Dear Carlos

I think the issue is that you have some zeroes.

 > table(O1, O2)
    O2
O1   1  2  3
   1  1  0  2
   2  0 10  0
   3  2  2  0
 >

Note that when you predict O1 from O2 level 3 of O2 gives a perfect 
prediction.

When you predict O2 from O1 level 2 gives a perfect prediction but I 
think you are saved here because the order constraint means that only 
zeroes at the extreme categories are fatal.

Try experimenting with zeroes in different places, perhaps using more 
levels with artificial data and see what happens and if I am right. 
Warning, I may be wrong.

On 16/05/2016 11:25, Carlos Bautista León wrote:
> 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]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Michael
http://www.dewey.myzen.co.uk/home.html



More information about the R-help mailing list