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 on April 23, and its replacement, statalist.org is already up and running.


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

st: RE: how to obtain demeaned data and detrended data in Stata


From   Jan Bryla <JBR@finansraadet.dk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: how to obtain demeaned data and detrended data in Stata
Date   Wed, 19 Oct 2011 14:03:14 +0200

Ama,
Demeaning the variable "var" by variable "id" can be done as follows (it this is indeed what you mean by demeaning)

egen mean_var = mean(var), by(id)
generate demeaned_var = var- mean_var

If you have multiple variables this may help you http://www.stata.com/statalist/archive/2010-09/msg00673.html

See -help egen-

Regarding your detrending question, I guess many people work with the Hodrick-Prescott filter, which is implementet in Stata as an ado-file from SSC. See -findit hprescott-

Maybe this neat presentation will help you http://www.stata.com/meeting/5nasug/TSFiltering_beamer.pdf
 
Christopher F Baum, 2004.
"HPRESCOTT: Stata module to implement Hodrick-Prescott filter for timeseries data," Statistical Software Components
S447001, Boston College Department of Economics, revised 28 Oct 2009.

Hope this helps
Jan Bryla




-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of amatoallah ouchen
Sent: 19. oktober 2011 13:16
To: statalist@hsphsun2.harvard.edu
Subject: st: how to obtain demeaned data and detrended data in Stata

Good day Stata Listers,
I would like to run KSS test (KAPETANIOS, G. – SHIN, Y. – SNELL, A.
2003: Testing for a UnitRoot in the Nonlinear STAR Framework) , but i
don't  know how to obtain demeaned data and detrended data .Could  you
describe me the process in STATA?
Many thanks in advance.

Ama

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