# Confidence of this particual prediction

I am looking for a confidence of model to predict well in a given situation.

So I have a model $f$ (generic, let's exemplify with a regression model of explicit form for brevity). It well fits on the train-set (by looking at say $r^2$), it well performs on the test set (by looking on RMSE). The fit is fine enough to predict with this model. Yet I want to know how confident am I to predict in this particular case, so while typically I look at the confidence $C$ of the model:

$C(f)$

while now I want to know what is the confidence of predicting with this model (subject to $x$):

$C(y=f(x))$

and I believe this shall strongly be related to presence of similar observations in the train/test sets and performance on similar observations.

Any hints on this welcomed.

• thanks, so let's then replace 'generic model' to 'linear regression'. Then isn't the confidence interval anyhow constant for the model, regardless the $x$ that we predict on? – Intelligent-Infrastructure Sep 3 '18 at 8:05
• you need the "standard error of prediction": $\hat y_0 \pm t^{\alpha/2}_{n-p}\hat\sigma \sqrt{1+x_0^T(X^TX)^{-1}x_0}$ if you want more details I suggest asking a separate question – oW_ Sep 4 '18 at 15:29