[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: reshaping panel data
There are two questions here.
1. Why is the post not getting through?
Nobody except Kelly can see this post to look at it,
as it did not get through.
So we have to guess. In general, there are three guesses.
(a) Kelly thinks she is a member of Statalist, but isn't.
But that isn't true here, as Kelly is receiving messages.
(b) Kelly is posting to Statalist from an email address
other than that known to Statalist. People do this a bit more
frequently than you might imagine, but it is less common
than the next one.
(c) Kelly is sending to Statalist something that is unwelcome
to Statalist _and_ it is getting trapped. That could be
an attachment sent deliberately
a pseudo-attachment such as MS Outlook often uses
a message sent in HTML
a message that is MIME-encoded
or something similar.
Now, sometimes people get away with sending one of these
things to Statalist. If you are a Majordomo expert, you can explain why
that is. No one on Statalist has ever yet claimed to be a
Majordomo expert, so your guess is as bad as ours.
As a temporary Bayesian, I put almost all
my prior probability on (c), leaving a smidgen on (b).
In short: send plain text only.
2. Why is the -reshape- command (not function) not working?
Because you have information about the structure of the data
that just is not apparent to -reshape-.
In your variable list
id chdep02 chdep00 chdep98 chwt00 chwt98 chwt96 wt98 wt96 wt94
there is an equivalence
chdep02 chwt00 wt98
chdep00 chwt98 wt96
chdep98 chwt96 wt94
that you know about but which you need to indicate to Stata.
No -recode-s are needed here. You just need to -rename-. That
The lazy way to do this is with -renvars-, installed from wherever that
was published last . I'll set -search renvars- as something to be
done. The single command
renvars chdep02 chdep00 chdep98 chwt00 chwt98 chwt96 wt98 wt96 wt94 \
chdep1-chdep3 chwt1-chwt3 wt1-wt3
should get you to a point where the -reshape- is easy.
Earnhart, Benjamin J
> I'm posting the message below on behalf of a colleague who,
> for some reason, is unable to it post herself. She can
> *receive* messages no problem, but when she posts, nothing
> happens. She's tried it from her va.gov address as well as a
> gmail account we set up. So substantive answers to her
> question would be appreciated of course, but clues as to why
> it won't let her post would also be great.
Richardson, Kelly K.
> > I need to run a gee regression and a multinomial logit on
> > panel data (3 time periods per person). I am trying to
> > reshape the data so that there are three lines per person.
> > However, when I use the reshape function in Stata I get
> > something else. I was looking at SAS code a colleage of mine
> > wrote to accomplish the same task and I tried to replicate it
> > using Stata but that didn't work either. I looked in the
> > Statalist archives but I couldn't find what I was looking for
> > so I'm putting the question to you.
> > Here's an example of the statistical models I want to run:
> > regress change in depression2002 on change in weight2000
> > controlling for weight1998
> > regress change in depression2000 on change in weight1998
> > controlling for weight1996
> > regress change in depression1998 on change in weight1996
> > controlling for weight1994
> > The models look like this:
> > xtgee chdep chwt wt, family(binomial) link(logit)
> > corr(independent) i(id) robust
> > OR
> > mlogit chwt chdep wt, robust cons(1) noconstant cluster(id)
> > Currently the data set looks like this:
> > id chdep02 chdep00 chdep98 chwt00 chwt98 chwt96 wt98 wt96 wt94
> > 1
> > 2
> > 3
> > I want the data to look like this:
> > id chdep chwt wt
> > 1 02 00 98
> > 1 00 98 96
> > 1 98 96 94
> > When I do reshape in Stata I get:
> > id chdep chwt wt
> > 1 02
> > 1 00 00
> > 1 98 98 98
> > 1 96 96
> > 1 94
> > I can create the structure I need by using a series of
> > recodes but that leaves too much room for error and it
> > doesn't easily translate from one project to another. I
> > figured if SAS can do it with some simple arrays Stata
> > probably can too.
* For searches and help try: