Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: var decomposition issues


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: var decomposition issues
Date   Sun, 11 Jul 2010 16:49:27 +0100

I doubt your syntax which has response and panel identifier both equal
to x. 

But something like 

gen predicted = . 

egen group = group(id) 
su group, meanonly 

forval i = 1/`=r(max)' { 
	tempvar pred 
	var <whatever> if group == `i' 
	predict `pred' 
	replace predicted = `pred' if group == `i'
	drop `pred' 
} 

should get you closer to where you want to be. See also. 

FAQ     . . . . . . . . . . Making foreach go through all values of a
variable
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N.
J. Cox
        8/05    Is there a way to tell Stata to try all values of a
                particular variable in a foreach statement without
                specifying them?
                http://www.stata.com/support/faqs/data/foreach.html

Nick 
[email protected] 

Alban Pinz

> I'm running univariate VARs for each cross-sectional unit in a panel
> dataset ie. [by x, sort : var x, lags(1/2)]. I then want to get
> predicted and residual variables for each regression, however I think
> whats happening is the program is taking the values from the very last
> regression and using them to predict values for the whole sample,
> which is screwing up my analysis of variance.
>
> How can I make stata use the estimates from each individual country
> VAR to give me a predicted value for ONLY that country? Preferably
> some way thats not going to take hours and hours to do. I have no idea
> about programming but I dont think it would be too hard, any help
> would be much appreciated!
>

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index