我正在数据集上运行广义加法模型。我起诉了这个fitDist()
功能,它建议使用 ZASICHEL 发行版
fitGS <- fitDist(gs, data=node_dat, k = 2, type = "counts", try.gamlss = TRUE)
> fitGS
Family: c("ZASICHEL", "zero adjusted Sichel")
Fitting method: "nlminb"
Call: gamlssML(formula = y, family = DIST[i])
Mu Coefficients:
[1] 2.056
Sigma Coefficients:
[1] 0.9261
Nu Coefficients:
[1] -1.19
Tau Coefficients:
[1] 3.087
Degrees of Freedom for the fit: 4 Residual Deg. of Freedom 82206
Global Deviance: 50781.8
AIC: 50789.8
SBC: 50827.1
但是,当我尝试运行模型时
mGS_zas <- gamlss(formula = gs ~ pb(SE_score) + TL + species + sex + season + year +
re(random = ~1|code)+ re(random = ~1|station),
family=ZASICHEL(), data=node_dat)
我收到这个错误
Error in dSICHEL(0, mu = mu, sigma = sigma, nu = nu) :
NA/NaN/Inf in foreign function call (arg 5)
这可能是什么原因?该模型在负二项分布的情况下运行良好。=,这是我在找到 fitDist 函数之前最初使用的。下面是一个可重现的小例子。
> dput(head(node_dat[, c(3,4,6,10,13,14,16,17)]))
structure(list(code = structure(c(99L, 204L, 183L, 146L, 4L,
135L), .Label = c("2390", "13573", "13574", "13575", "13576",
"19318", "19319", "19321", "19322", "19506", "19514", "19519",
"19520", "19524", "25537", "25540", "25541", "25543", "25546",
"25549", "25552", "25553", "27583", "27585", "27586", "27591",
"27592", "27593", "27594", "27595", "27596", "27597", "27600",
"27601", "27605", "27607", "27608", "27613", "27614", "27617",
"27619", "27620", "27621", "27626", "27627", "27629", "27630",
"27631", "27632", "28608", "28611", "28612", "28618", "28625",
"28628", "28629", "28631", "28632", "28633", "28638", "28641",
"28644", "28662", "28672", "28674", "52978", "54815", "54846",
"54852", "54860", "54863", "54865", "54866", "54868", "54877",
"54882", "54883", "54884", "54886", "54890", "54892", "54895",
"54896", "54901", "54904", "54914", "54919", "54920", "54922",
"54925", "54931", "54932", "54938", "54952", "54954", "54955",
"54958", "54959", "54962", "59950", "59953", "59954", "59955",
"59957", "59958", "59959", "59960", "59961", "59962", "59964",
"59966", "59969", "59970", "59971", "59972", "59973", "59975",
"59976", "59979", "59981", "59988", "2388", "12950", "12952",
"12956", "12958", "12960", "12962", "12964", "12966", "12968",
"13577", "14203", "19320", "19523", "25534", "25535", "25536",
"25539", "25542", "25544", "25545", "25547", "25548", "25550",
"27584", "27588", "27589", "27590", "27598", "27599", "27602",
"27603", "27604", "27606", "27609", "27610", "27611", "27615",
"27616", "27618", "27622", "27624", "27625", "28624", "28627",
"28637", "28639", "28642", "28660", "28670", "34176", "34177",
"34178", "34179", "52975", "52977", "54817", "54821", "54822",
"54825", "54845", "54849", "54880", "54887", "54889", "54893",
"54898", "54899", "54905", "54911", "54912", "54915", "54933",
"54947", "54957", "54961", "59951", "59963", "59968", "59978",
"59991", "59992", "59993", "59994", "59995"), class = "factor"),
species = structure(c(1L, 2L, 2L, 2L, 1L, 2L), .Label = c("Grey Reef Shark",
"Silvertip Shark"), class = "factor"), gs = c(0, 0, 0, 0,
0, 0), SE_score = c(0.35, 0.39, 0.18, 0.23, 0.36, 0.42),
month = c(3, 5, 2, 4, 7, 5), season = structure(c(2L, 1L,
2L, 1L, 1L, 1L), .Label = c("dry.season", "wet.season"), class = "factor"),
sex = structure(c(1L, 2L, 2L, 1L, 1L, 2L), .Label = c("F",
"M"), class = "factor"), TL = c(117, 157, 137, 108, 94, 137
)), row.names = c(31669L, 80335L, 63799L, 59674L, 1051L,
51949L), class = "data.frame")