Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: re: predicting y, with other variables

From   Kit Baum <>
Subject   st: re: predicting y, with other variables
Date   Tue, 22 May 2007 10:39:15 -0400

sacrificial cabbage

Alessia said

I hope some of you can help me...
I estimate a regression and I saved the coefficients e(b) in the
corresponding matrix. Now I would like to apply these coefficients
estimates to the same set of x's variables, but for one that I want to
substitute with another and calculate the predicted values (to see
which is the variation in the rpedicted values using this other
variables). Anyone of you knows how to do this?
I tried creating a matrix with the new x's variables, but my n=2400
and so the matsize set does not allow me to create such a matrix.

Just create additional observations in your x matrix for the observations for which you want to predict 'out of sample'. When you run the regression, those observations will be ignored as their value of y is missing. Then

predict double oos if ~e(sample)

will generate predictions (using the default , xb) for the observations that are not in the regression sample.

Kit Baum, Boston College Economics and DIW Berlin
An Introduction to Modern Econometrics Using Stata:

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index