# Estimating a sum with linear regression - what is the error?

I have a linear model with the following parameters:

                                  OLS Regression Results
==========================================================================================
Dep. Variable:     TOTAL_Presented_Young_ppl_2014   R-squared:                       0.417
Method:                             Least Squares   F-statistic:                     112.2
Date:                            Thu, 13 Aug 2015   Prob (F-statistic):           4.04e-20
Time:                                    07:31:57   Log-Likelihood:                -1124.2
No. Observations:                             159   AIC:                             2252.
Df Residuals:                                 157   BIC:                             2259.
Df Model:                                       1
Covariance Type:                        nonrobust
=======================================================================================
coef    std err          t      P>|t|      [95.0% Conf. Int.]
---------------------------------------------------------------------------------------
Intercept              14.3737     31.464      0.457      0.648       -47.774    76.522
LA_Population_young     0.0128      0.001     10.592      0.000         0.010     0.015


FWIW, it's the relation between a local population and the number of young homeless people. Each data row corresponds to a district in a country.

It is not a good model, I know, but that's a different matter. My question is: What are my options for stating the error of the sum of predictions?

My final goal is to predict the number in the whole country, i.e. sum(prediction). Could I build two upper- and lower-limit predictions, based on the confidence intervals:

Y_upper = 76.552 + 0.015*X
Y_lower = -47.774 + 0.01*X


Then sum those and say my 95% confidence interval on the prediction is [sum(Y_lower), sum(Y_upper)]? Effectively I would have bounds like these: Does this make sense? If not, why and what would be a better way?

If you do a linear regression $y=\beta_1 x + \beta_2 + \epsilon$ where $\epsilon$ is a random error term, normal with mean zero and standard deviation $\sigma$ i.e. $\epsilon \sim N(0, \sigma)$, then OLS estimates three parameters: $\hat{\beta}_1, \hat{\beta}_2, \hat{\sigma}$. I don't know which software you use but in R, the $\hat{\sigma}$ can be found as 'residual standard error' in the output of the summary function.

You should use the fitted values $\hat{y}$ plus or minus two standard diviations $\hat{\sigma}$.

So, by the model that you have choosen, the implicit assumption is that you can never measure $y$ with precision (your model assumes that $y=\beta_1 x + \beta_2 + \epsilon$, so the imprecision you assume is implicit in the randomness of $\epsilon$ that is expressed by the parameter $\sigma$).
If you look at a textbook on Ordinary Linear Least Squares, then the assumption of normality on the error term implies that the estimators for the parameters $\hat{\beta}_i$ are normal with a standard deviation that is related to $\sigma$, so they can never be estimated with precision neither (because they are random) and you can compute their standard deviation. Therefore you can construct confidence intervals for the estimated $\hat{\beta}_i$. Note that the $\hat{\beta}_i$ are not independent, so their estimation errors may compensate. If you take for each estmated $\hat{\beta}_i$ the 'worst case' error, then you overestimate the total error.
• Do you mean I should calculate the standard deviation $\sigma = \sqrt{\sum (y-\hat{y})^2/(N-2)}$ (std for a sample), and then the bounds would be $\sum (\hat{y}- 2\sigma)$ and $\sum (\hat{y}+ 2\sigma)$ ? – alkamid Aug 13 '15 at 7:15
• This is what I mean, except that your $\sigma$ is an estimate, so it is better to use the notation $\hat{\sigma}$. – user83346 Aug 13 '15 at 7:20