From: "Nick Cox" <email@example.com>
Subject: st: RE: seasonality
Date: Fri, 1 Apr 2005 16:57:48 +0100
Welcome back after your hiatus.
To centre a variable you need to go
su y, meanonly
gen yc = y - r(mean)
except that this is such a common need
that users have created commands to
do that for you. For example, look at Ben Jann's
-center- on SSC:
. ssc desc center
Your question about seasonality is much
fuzzier. There are lots of different ways
of testing for seasonality. In the
environmental sciences, I would usually
try fitting sine and cosine terms given
2 * pi * (position in year / length of year).
That is, also, I guess a congenial approach
for most natural scientists.
With economic or social data other methods appear
more common, and may or may not be more
appropriate. People seem happier with looking
at lags 4, 12, whatever depending on whether
data are quarterly, monthly, whatever. That may
be what SAS command proc x12 does. But
the adjustments seem much more complicated
given complications like holidays that are
irrelevant outside the human sphere.
In any case, graphics are often useful
for getting a handle on seasonality and
often surprising neglected by people like
Without knowing more about your data
or your research problem this is rather too
large a question to answer well. In short, the
question may be quick but the answer isn't.
> I am returning to stata after a hatus of a couple of years. I
> had two quick questions:
> Suppose I am using a stream of time seies data for a single
> varible (Data, Variable1):
> (1) suppose i wanted to generate a new varible that equale
> variable1 - the
> mean of varible1. how do i do this (without having to create
> a whole column
> with only the mean of variable1 in it)?
> (2) is there an easy wasy to test for seasonality? in sas we
> have the proc
> x12 command? what's a quickand eqasy way to test for
> seasonality in data?
* For searches and help try: