Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: RE: RE: var decomposition issues


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: var decomposition issues
Date   Sun, 11 Jul 2010 18:02:23 +0200

<>

Also try the recipes contained in this recent thread:
http://www.stata.com/statalist/archive/2010-06/msg01504.html



HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: Sonntag, 11. Juli 2010 17:49
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: var decomposition issues

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 
n.j.cox@durham.ac.uk 

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/

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index