[英]Error in chol.default(Cxx) : the leading minor of order is not positive definite
[英]Getting Error in chol.default(K) : the leading minor of order 5 is not positive definite with betareg
我正在嘗試使用betareg
package
的betareg
function
將beta
regression
模型擬合到這些數據:
df <- data.frame(category=c("c1","c1","c1","c1","c1","c1","c2","c2","c2","c2","c2","c2","c3","c3","c3","c3","c3","c3","c4","c4","c4","c4","c4","c4","c5","c5","c5","c5","c5","c5"),
value=c(6.6e-18,0.0061,0.015,1.1e-17,4.7e-17,0.0032,0.29,0.77,0.64,0.59,0.39,0.72,0.097,0.074,0.073,0.08,0.06,0.11,0.034,0.01,0.031,0.041,4.7e-17,0.025,0.58,0.14,0.24,0.29,0.55,0.15),stringsAsFactors = F)
df$category <- factor(df$category,levels=c("c1","c2","c3","c4","c5"))
使用此命令:
library(betareg)
fit <- betareg(value ~ category, data = df)
我收到此error
:
Error in chol.default(K) :
the leading minor of order 5 is not positive definite
In addition: Warning message:
In sqrt(wpp) : NaNs produced
Error in chol.default(K) :
the leading minor of order 5 is not positive definite
In addition: Warning messages:
1: In betareg.fit(X, Y, Z, weights, offset, link, link.phi, type, control) :
failed to invert the information matrix: iteration stopped prematurely
2: In sqrt(wpp) : NaNs produced
是否有任何解決方案或 beta 回歸根本無法擬合這些數據?
將 beta 分布擬合到類別 1 中的數據將非常具有挑戰性,因為三個觀測值基本上為零。 四舍五入為五位數:0.00000、0.00000、0.00000、0.00320、0.00610、0.01500。 我不清楚這個類別是否應該以與其他類別相同的方式建模。
在類別 4 中,還有一個數值為零的觀測值,盡管其他觀測值稍大一些:0.00000、0.01000、0.02500、0.03100、0.03400、0.04100。
省略類別 1 至少允許在沒有數值問題的情況下估計模型。 對於來自每組六個觀測值的兩個參數,漸近推理是否是一個很好的近似是另一個問題。 不過,各組之間的精度似乎並不相同。
betareg(value ~ category | 1, data = df, subset = category != "c1")
## Call:
## betareg(formula = value ~ category | 1, data = df, subset = category !=
## "c1")
##
## Coefficients (mean model with logit link):
## (Intercept) categoryc3 categoryc4 categoryc5
## 0.2634 -2.2758 -4.4627 -1.0206
##
## Phi coefficients (precision model with log link):
## (Intercept)
## 2.312
betareg(value ~ category | category, data = df, subset = category != "c1")
## Call:
## betareg(formula = value ~ category | category, data = df, subset = category !=
## "c1")
##
## Coefficients (mean model with logit link):
## (Intercept) categoryc3 categoryc4 categoryc5
## 0.2566 -2.6676 -4.0601 -0.9784
##
## Phi coefficients (precision model with log link):
## (Intercept) categoryc3 categoryc4 categoryc5
## 2.0849 3.5619 -0.2308 -0.1376
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.