pred.response {abundant} | R Documentation |
Let x\in R^p
denote the values of the p
predictors.
This function computes \widehat E(Y|X=x)
using equation (8.1)
of Cook, Forzani, and Rothman (2012).
pred.response(fit, newx=NULL)
fit |
The object returned by |
newx |
A matrix with |
See Cook, Forzani, and Rothman (2012) for more information.
A vector of response prediction with nrow(newx)
entries.
Adam J. Rothman
Cook, R. D., Forzani, L., and Rothman, A. J. (2012). Estimating sufficient reductions of the predictors in abundant high-dimensional regressions. Annals of Statistics 40(1), 353-384.
set.seed(1)
n=25
p=50
d=1
true.G = matrix(rnorm(p*d), nrow=p, ncol=d)
y=rnorm(n)
fy = y
E=matrix(rnorm(n*p), nrow=n, ncol=p)
X=fy%*%t(true.G) + E
fit=fit.pfc(X=X, r=4, d=d, y=y, weight.type="diag")
fitted.values=pred.response(fit)
mean((y-fitted.values)^2)
plot(fitted.values, y)
n.new=100
y.new=rnorm(n.new)
fy.new=y.new
E.new=matrix(rnorm(n.new*p), nrow=n.new, ncol=p)
X.new = fy.new%*%t(true.G) + E.new
mean((y.new - pred.response(fit, newx=X.new))^2)