R障碍:在sqrt(diag(对象$ vcov))中:NaNs生成

时间:2016-06-07 04:01:02

标签: r

我有一个来自csv的数据帧,它包含1个因变量(y)和7个独立变量(x' s)。 Y由许多零组成。所以我想使用hurdle(截断的poisson为count,logit为零) 这是我的代码

library(pscl)
data <-  read.csv("D:/data.csv", header=TRUE, sep=",")
head(data)
x1 <- data$X1
x2 <- data$X2
x3 <- data$X3
x4 <- data$X4
x5 <- data$X5
x6 <- data$X6
x7 <- data$X7
y <- data$Y

data <- data.frame(x1,x2,x3,x4,x5,x6,x7,y)
head(data)
hurdlepois <-hurdle(y~x1+x2+x3+x4+x5+x6+x7, data=data)
summary(hurdlepois)

结果是有系数,但std.error中有NaN。我收到警告

Warning message:
In sqrt(diag(object$vcov)) : NaNs produced

有人建议我做这个代码

ctrl <- hurdle.control(method = "L-BFGS-B")
ctrl$reltol <- NULL
hurdlepois <-hurdle(y~x1+x2+x3+x4+x5+x6+x7, data=data, control = ctrl)
summary(hurdlepois)

但是当我运行hurdlepois&lt; -hurdle(y~x1 + x2 + x3 + x4 + x5 + x6 + x7,data = data,control = ctrl)时出现此错误

Error in optim(fn = countDist, gr = countGrad, par = c(start$count, if (dist ==  : 
  L-BFGS-B needs finite values of 'fn'
你能帮帮我吗?请给我详细解决方案我应该怎么做,因为我是初学者,所以绝望。非常感谢你。

0 个答案:

没有答案