Missayei 2019-10-20 14:46 采纳率: 0%
浏览 1550

用R做门限面板回归提示“number of items to replace is not a multiple of replacement length”

在用R做门限面板回归的时候提示“Error in dd[, j] <- (thresh < rrr[j]) :
number of items to replace is not a multiple of replacement length”是为什么呢?

数据是时间长度为4年,截面个数为3366的平衡面板数据。具体代码如下:

pdtcfps <- pdata.frame(cfps, index = c("fid12", "wave"))
pdtcfps$MdL <- (pdtcfps$agrimachine+pdtcfps$rentformachine.irr)/pdtcfps$land
t <- 4
n <- nrow(pdtcfps)/t
dep <- as.matrix(log(pdtcfps$output+1)) #被解释变量
th1 <- as.matrix(log(pdtcfps$labor+1))
th2 <- as.matrix(log(pdtcfps$land+1))
th3 <- as.matrix(log(pdtcfps$agrimachine+pdtcfps$rentformachine.irr+1))
th4 <- as.matrix(log(pdtcfps$seeds+pdtcfps$feeding+pdtcfps$other_expenses+1))
ind1 <- cbind(th1, th3, th4) #与门限有关的解释变量
ind2 <- th2 #没有门限的被解释变量
d <- as.matrix(pdtcfps$MdL) #作为门限的变量
bootn <- c(300, 400, 500) #找三个门限时各自bootstrap的个数
trimn <- c(0.05, 0.05, 0.05) #trimmed percentage
qn <- 100 #no. of quantiles to examine
conf_lev <- 0.95
output <- ptm(dep, ind1 = ind1, ind2 = ind2, d = d, bootn = bootn, trimn = trimn, qn = qn, conf_lev = conf_lev, t = t, n = n)

是不是trimmed percentage设置的不对的问题?应该怎么设置呢?

  • 写回答

1条回答 默认 最新

  • 上海滩林哥 2021-01-23 16:02
    关注

    同样问题,求解

    评论

报告相同问题?

悬赏问题

  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机