用nlrq函数建立非线性分位数回归模型的过程中出现Error in cll[[1]] : object of type 'symbol' is not subsettable的错误,代码如下,请教如何修改
# parameter selection by 10-fold cross validation
library(quantreg)
val.res <- data.frame(tau = numeric(length = 99), mre = numeric(length = 99))
index <- 1
for(tau in seq(from = 0.01, to = 0.99, by = 0.01)) {
cat("Validating tau == ", tau, "\n", sep = "")
pred.oob <- numeric(length = nrow(train))
for(i in 1:10) {
from <- (i-1)*nrow(train)/10 + 1
to <- (i-1)*nrow(train)/10 + nrow(train)/10
lqr<-nlrq(response ~ ., data = train[-c(from:to), ], tau = tau , trace=TRUE)
pred.oob[from:to] <- predict(lqr, newdata = train[from:to, ])
}
val.res$tau[index] <- tau
val.res$mre[index] <- mean(abs(pred.oob - train$response)/train$response)
index <- index + 1
}