全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1722 0
2016-08-02
用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
}
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群