Macc0927
Macc0927
2021-01-22 00:16

R语言 EM 伽马 建模时报错了 请教各位大神,问题出在那里?

  • r语言

df是包含TP1NP一个变量的数据框

tsh.hist <- hist(df1$TP1NP, breaks = seq(0,max(df1$TP1NP) + 0.1, 0.1), plot = FALSE)
tsh.df <- data.frame(tsh = tsh.hist$breaks[2:length(tsh.hist$breaks)],freq = tsh.hist$counts)
tsh.df <- as.mixdata(tsh.df)
fitg <- mix(tsh.df,
            mixparam(c(0.1,2,6),c(0.1,1,2)),
            constr = list(
              conpi = "NONE",
              conmu = "MFX",
              consigma = "SFX",
              fixpi = NULL,
              fixmu = c(FALSE,FALSE, FALSE),
              fixsigma = c(FALSE,FALSE, FALSE)),
            "gamma", emsteps = 1)

fitg.coef <- coef(fitg, natpar = TRUE) -> tshg

报错:Error in nlm(mixlike, lmixdat = mixdat, lmixpar = fitpar, ldist = dist,  :    参数里不能有遗漏值 

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答