在用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设置的不对的问题?应该怎么设置呢?