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, is already up and running.

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

Re: st: svy + aweights

From   Jeph Herrin <>
Subject   Re: st: svy + aweights
Date   Thu, 10 Nov 2011 16:01:41 -0500

But doesn't your suggestion ignore the correlation of observations within

On 11/10/2011 3:39 PM, Stas Kolenikov wrote:
You do need to -reshape long-, and then you can do any analysis with
these daily measures. E.g., you could -svy : mean daily_outcome ,
over(obese)-. Since the latter is an estimation command, you'd be able
to form (a version of) the t-test by the standard post-estimation
-test- command. I don't think you need any averaging here at all.

On Thu, Nov 10, 2011 at 3:23 PM, Jeph Herrin<>  wrote:

For each day, I have 1440 minutes (24 hours) of measurements. Each minute
has an activity measure, 0-30,000. I want to compare how active the kids
(these are all children) are, so I calculate an activity measurement for
each day (to keep it simple here I will say it is the median, though
it is a complicated function of the activity levels over the day).

id   day1 day2 day3   obese  average  days
1    500   500  500     Y      500      3
2    1000               N     1000      1

Now I want to compare kids who are normal weight to those who are
obese. It turns out, I don't have as many measurements on the obese
kids because they did not wear their monitor as often. So the
active kids have more precise daily averages than the obese kids.
To compare average activity, I want to account for the differences
in precision.

If this was not -svy- data, I would use something like

   ttest average [aw=days], by(obese)

even better -reshape- the data to have one record per day per id and use

  xtset id
  xtreg average

But here I have this complex survey design to deal with.


On 11/10/2011 3:06 PM, Joerg Luedicke wrote:

I do not quite understand what you are trying to do. Suppose we have
two individuals, one measured only once and the other on, say, 3
occasions. Let's further assume that activity is measured in minutes
(btw, how is your dependent variable measured?). We could have the
following data:

id day1 day2 day3
1  30
2  10  10  10

If you calculate the minutes per day now (whether or not this being a
proper way of handling it), id#1 will end up with 30 and id#2 with 10
minutes. I do not understand why id#2 is supposed to weigh more than


On Thu, Nov 10, 2011 at 2:34 PM, Jeph Herrin<>    wrote:

Thanks for the suggestion, but I specifically need to give more
weight to subjects which have more days of observation. For example,
I have

   svy : regress activity female BMI

and would like this regression to give more weight to subjects which
have more days of observation. Using activity/days as the dependent
variable will not do this.


On 11/10/2011 1:58 PM, Stas Kolenikov wrote:

Rather than forming the mean activity per day, you might want to
analyze this as a ratio:

svy : ratio activity / day_reported

or whatever would be an appropriate ratio. That way, you will get
correct standard errors without messing with the analytical weights.

On Thu, Nov 10, 2011 at 1:46 PM, Jeph Herrin<>

I am analyzing NHANES data (see manual page for -svyset-) using -svy-
commands. My complication is that I am using the subset of subjects for
which there is activity monitoring, and the number of days monitored
from 1 to 8. So - to be clear - for some subjects I have 1 day of
and for some I have 2 days, some I have 3, etc. My dependent variable
interest is daily average activity levels, but I would like this to be
weighted by the number of days monitored. (This is important because
seems to be a clear relationship between days monitored and age, race,

How do I incorporate this additional level of weighting? For instance,
if I use

  svy : mean depvar [aw=days]

I get an error that weights are not reported.

*   For searches and help try:

*   For searches and help try:

*   For searches and help try:

No virus found in this message.
Checked by AVG -
Version: 2012.0.1869 / Virus Database: 2092/4607 - Release Date: 11/09/11

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index