# Re: st: calculating the confidence intervals for the difference in predicted values

 From stata user To statalist@hsphsun2.harvard.edu Subject Re: st: calculating the confidence intervals for the difference in predicted values Date Mon, 19 Oct 2009 01:00:07 -0700

```Thanks Maarten for your suggestions.

Yes, I expect to get one confidence interval for each observation. The
context for this exercise is that, for example, we want to study the
housing price difference in two regions. I first run a regression to
determine how the housing charateristics (X) would affect a house
price (Y), based on region A's data. Then I make an out-of-sample
prediction of house price in region B. And make a in-sample prediction
of house price in region A. The the difference btw the two predictions
would be the difference in housing prices between region A and region
B, if both of the housing prices depend on the same set of housing
characteristics. I just wanted to get rid of the unobservables that
affect a particular region's housing price--so that i can have an
apple-to-apple comparison. And I want to know the error of such an
estimate.

I took a look at the lincom and nlcom too, but I still don't know how
to implement this calculation because I have a lot of explanatory
variables, and over 1000 observations, and I want to do it once and
for all the observations at the same time. However, lincom and nlcom
seem to only allow me to do it for one observation every time. I am
sure whether I can use the lincom or nlcom command in some matrix
form...any ideas?

On Mon, Oct 19, 2009 at 12:34 AM, Maarten buis <maartenbuis@yahoo.co.uk> wrote:
> --- On Mon, 19/10/09, stata user wrote:
>> I have a question on how to calculate confidence intervals
>> for the difference between two predicted values.
>
> <snip>
>
>> Also, what if I want to find Var(Y_in/Y_out)?--i.e. now we
>> want to estimate the variance of a nonlinear function of
>> the two predicted values.
>
> I am not quite sure what it is exactly that you are trying to do:
> do you expect to get one number out of this calculation, or a
> number for every observation in your data, how do you want to
>
> So the only advise I can give you is to take a look at -lincom-,
> -nlcom-, and -predictnl-.
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```