R语言 怎么求该模型的AIC和BIC??
powdiscrep <- function(parms,rec,ri){
if(any(parms<0)|| any(parms>1)) return(1e6)
pow_pred <- ri^(-parms["a"])
return(sqrt(sum((pow_pred-rec)^2)/length(ri)))
}
ri <- c(1,2,2.5,4,5,6,8,10)
rec <- c(1.05,0.48,0.41,0.25,0.23,0.15,0.12,0.09)
sparms <- c(0.5)
names(sparms) <- c("a")
pout <- optim(sparms,powdiscrep,rec=rec,ri=ri)
pow_pred <- c(min(ri):max(ri))^(-pout$par["a"])
x11()
par(cex.axis=1.2,cex.lab=1.4)
par(mar=(c(5,5,3,2)+0.1),las=1)
plot(ri,rec,
xlab="X",
ylab="Y",
ylim=c(0,1.10),xlim=c(1,10),xaxt="n",type="n",main="冥函数RMSD")
lines(spline(c(min(ri):max(ri)),pow_pred),lwd=2) #拟合曲线
points(ri,rec,pch=21,bg="dark grey",cex=2) #画出设定点
axis(1,at=c(1:10)) #x轴