MLE error in R: initial value in 'vmmin' is not finite

后端 未结 3 1702
误落风尘
误落风尘 2020-12-18 21:16

Suppose I have 2 data.frame objects:

df1 <- data.frame(x = 1:100)
df1$y <- 20 + 0.3 * df1$x + rnorm(100)
df2 <- data.frame(x = 1:200000         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-18 21:52

    I had the same problem when minimizin a log-likelihood function. After some debugging I found that the problem was in my starting values. They caused one specific matrix to have a determinant = 0, which caused an error when a log was taken of it. Therefore, it could not find any "finite" value, but that was because the function returned an error to optim.

    Bottomline: consider if your function is not returning an error when you run it using the starting values.

    PS.: Marius Hofert is completely right. Never suppress warnings.

提交回复
热议问题