# Given a fitted regression model, how to calculate the p-value of a new observation?

(apologies in advance if I abuse any terminology)

I have a series of XY data points that I fit with a simple regression and I would like to be able to use this regression to obtain a p-value for the new data point. I have found a couple of sources describing how to calculate a Prediction Interval for Responses to a Particular x which seems to almost answer this question. In fact, I think I can reformulate my question as how do I find the alpha of the smallest prediction interval containing my new data point.

-
Hi there, as alpha is increased, your prediction interval shrinks, so you can literally plug different alphas into a standard formula and get various widths of prediction interval. This does not seem to answer your question. What do you mean by smallest prediction interval? –  Michelle Feb 20 '12 at 18:53
Hi Michelle, What I mean by the smallest interval is: there is an infinite set of intervals (each with its own alpha) some of which contain my new observation. I want to find the smallest of these. You are right that I can search from the answer by plugging in different values of alpha and checking if the new observation in in the interval but I was hoping for a more efficient approach since I'll have to run this calculation many times in a loop. Thank you. –  Keith Feb 20 '12 at 19:17
I'm not sure that this is a trivial question, as what sample size, etc, do you assume for each of the new data points? –  Michelle Feb 20 '12 at 19:24
Sorry if I'm being dense here and missing your point but there is always only a single new data point that I want to test against a single fitted regression. It is just that I am doing this many thousands of times (in each case it is a unique regression with a unique observation to test). –  Keith Feb 20 '12 at 19:36
Basically, it would be trivial to estimate the minimum critical t-value etc off the data you have if you could base the bulk of the calculation on the information from your original regression. For example, E would be estimated as the difference between the predicted value and the actual value of your new data point, then it is just a matter of solving for the critical t-value in the "margin of error" equation you have in your link, then looking at the alpha level for that t-value.
The issue is that the standard error, etc, used in that equation would not take account of your new data points, because it would only be based on the original regression data. You could redo the regression for every new set of data points you receive, which would update the SS etc, then work backwards using the updated information for the equations. This won't be too much of an issue if the new data comes in as a set.