PredictAdaptiveReg = function(fit,xnew){
tmp = as.vector(predZg(fit$ZgMoments,fit$ZgMoments$dta$x,fit$nv))
xbar = mean(tmp)
ybar = mean(fit$ZgMoments$dta$y)
covxy = cov(tmp,fit$ZgMoments$dta$y)
varx = var(tmp)
b = covxy/varx
a = ybar-b*xbar
res = a+b*as.vector(predZg(fit$ZgMoments,xnew,fit$nv))
return(res)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.