# USE GCV TO CHOOSE BANDWIDTH
library(locfit)
wmap = read.table(file='c:/wmap.dat',header=T)
x=wmap$ell[1:700]
y=wmap$Cl[1:700]
h=15
deg=1
# USE GCV TO CHOOSE BANDWIDTH
alphamat = matrix(0,ncol=2,nrow=30)
alphamat[,2] = (1.2^(seq(30)-30))*2*(max(x)-min(x))
gcvs = gcvplot(y~x,alpha=alphamat,deg=deg,maxk=1000)
optband = max(gcvs$alpha[gcvs$values == min(gcvs$values),2]) #63.0124
......
提供三个文件wmap.dat,optbandByGcv.R,Choosing the Bandwidth.pdf