没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
试读
2页
灰色关联度GM(1,1)的R代码计算运行,运用R做GM(1,1)关联度分析,代码运行 灰色关联度GM(1,1)的R代码计算运行,运用R做GM(1,1)关联度分析,代码运行 灰色关联度GM(1,1)的R代码计算运行,运用R做GM(1,1)关联度分析,代码运行 灰色关联度GM(1,1)的R代码计算运行,运用R做GM(1,1)关联度分析,代码运行 灰色关联度GM(1,1)的R代码计算运行,运用R做GM(1,1)关联度分析,代码运行
资源推荐
资源详情
资源评论
x<-c(1,2,3,4,5,6,7)
x0 <- x
k = length(x0)
# AGO
x1 = cumsum(x0)
# construct matrix B & Y
B = cbind(-0.5*(x1[-k]+x1[-1]),rep(1,times=k-1))
Y = x0[-1]
# compute BtB...
BtB = t(B)%*%B
BtB.inv = solve(BtB)
BtY = t(B)%*%Y
# estimate
alpha = BtB.inv%*%BtY
# 建立预测模型
predict <- function(k) {
y = (x0[1] - alpha[2]/alpha[1])*exp(-alpha[1]*k)+alpha[2]/alpha[1]
return(y)
}
pre <- sapply(X=0:(k-1),FUN=predict)
prediff <- c(pre[1],diff(pre))
# 计算残差
error <- round(abs(prediff-x0),digits=6)
phi=error/x0
emax <- max(error)
emin <- min(error)
# 模型评价
incidence <- function(x) {
return((emin + 0.5*emax)/(x+0.5*emax))
}
enta=sapply(error,incidence)
degree <- mean(sapply(error,incidence))
s1 <- sqrt(sum((x0-mean(x0))^2)/5)
s2 <- sqrt(sum((error-mean(error))^2)/5)
C <- s2/s1
e <- abs(error-mean(error))
p <- length(e<0.6745)/length(e)
result <- list(alpha=alpha,fit = prediff,error=error,phi=phi,enta=enta,degree = degree, s1=s1,s2=s2,C
资源评论
?shan
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功