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 一道python难题
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度