# pred.response: Predict the response with the fitted high-dimensional... In abundant: High-Dimensional Principal Fitted Components and Abundant Regression

## Description

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).

## Usage

 1 pred.response(fit, newx=NULL) 

## Arguments

 fit The object returned by fit.pfc(). newx A matrix with N rows and p columns where each row is an instance of x described above. If this argument is unspecified, then the fitted values are returned, i.e, newx=X, where X was the predictor matrix used in the call to fit.pfc().

## Value

A vector of response prediction with nrow(newx) entries.

## References

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.

fit.pfc
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 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)