Statalist The Stata Listserver

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

Re: st: predicting y, with other variables

From   Richard Williams <>
Subject   Re: st: predicting y, with other variables
Date   Tue, 22 May 2007 10:45:21 -0500

At 09:28 AM 5/22/2007, alessia matano wrote:

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.

Thank you very much for your help.
I'm not totally sure I understand you alessia. Is the idea that you want to do something like

reg y x1 x2 x3

but then substitute x4 for x3 when computing predicted values? If so, try something like

clonevar tmpvar = x3
reg y x1 x2 tmpvar
predict yhat1
drop tmpvar
clonevar tmpvar = x4
predict yhat2

Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME: (574)289-5227
EMAIL: Richard.A.Williams.5@ND.Edu

* For searches and help try:

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