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]

From |
Steve Samuels <sjsamuels@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: AW: AW: st: error message "too many weights" |

Date |
Tue, 27 Mar 2012 05:13:48 -0400 |

Jette Kellerhoff- Your use of the words "panel" and "wave". suggests that you have survey data. If so, the weight should be designated a probability weight (pweight). At a minimum then, you need [pweight = gew] in the -stset- statement. This will give you properly weighted estimates of descriptive statistics like the survival curve. If the survey had a multi-stage design and you intend to run regression commands like -stcox-, you will need to -svyset- the data. If you don't, standard errors and p-values will be wrong. The -svyset- statement has the form: ********************************************* svyset psu_var [pw = gew], strata(stratum_var) ********************************************* After that, use the -svy:- prefix for -stcox- and -streg-. If you are planning multiple failure time analyses and weights are constant within id, then you will be omit the cluster(id) option in -stset-. That won't matter, because standard errors will be based on the survey design. If weights are not constant within ID, -stset- will complain. So check first. You have multiple spell data, apparently, and I'm not sure of your data structure. But a generic solution is to add an enter() option to the -stset- statement and omit the id() option. The code would be something like: *************CODE BEGINS************* svyset psu_var [pw = gew], strata(stratum_var) stset tfp , fail(event indicator) enter(start time for spell) exit(time.) svy: stcox // etc. ************************************** Steve sjsamuels@gmail.com See also: http://www.stata.com/statalist/archive/2008-10/msg01494.html. On Mar 26, 2012, at 5:03 AM, Nick Cox wrote: I could tell you how to force non-integers to integers but I fear that would be telling how to force your problem into an incorrect or dubious application of -st-. I am in no sense an expert on survival analysis, so I won't comment further. This may or may not be enough information for someone competent in that field to get a sense of what your real problem is and give better advice. Nick On Mon, Mar 26, 2012 at 9:44 AM, Jette Kellerhoff <jettek82@aol.com> wrote: > For each subject exists a weight (variable gew), which identifies the real > abundance pattern in time. The computed values of the variable gew are the > result of the real abundance pattern multiplied by the probability to stay > in the panel. So in many cases the results are not integers. How to create > integers? Nick Cox > I could tell you about Stata. But you really need to explain what the > variable -gew- is, why some values are not integers, and why you want > to treat them as frequency weights. On Sun, Mar 25, 2012 at 6:50 PM, Jette Kellerhoff <jettek82@aol.com> wrote: >> There are some non-integer values. How to create integers? Nick Cox >> The implication is that your variable -gew- contains non-integer >> values. Is that true? >> >> . list gew if gew != floor(gew) >> >> fweights indicate frequencies, which must be integers. On Sun, Mar 25, 2012 at 6:09 PM, Jette Kellerhoff <jettek82@aol.com> >>> I removed the first bracket, but the error message is still the same: may >>> not use noninteger frequency weights >>> stset tfp [fweight = gew], id(hhnrakt) f(des=2 4 6 8 10 12) exit(time .) Steve Samuels >>> You did not follow my advice to look at the examples. You only removed > the >>> last bracket; the beginning "[" of the second pair remains. On Mar 25, 2012, at 12:40 PM, Jette Kellerhoff wrote: >>> Thanks for your advice. If I remove the brackets, I get the following >> error >>> message may not use noninteger frequency weights. I don't understand it, >>> because fweights are allowed in the stset-command. >>> The do-file: >>> stset tfp [fweight=gew] [ ,id(hhnrakt) f(des=2 4 6 8 10 12) exit(time.) Steve Samuels >>> I should add that in the -help- for -stset-, the brackets indicate where >>> options, if any, should go. Before running an unfamiliar command, always >>> look at the examples at the bottom of the help screen or in the manual. >>> Remove the second pair of brackets in your -stset- statement. They are > not >>> legal Stata syntax. On Mar 22, 2012, at 3:18 PM, Jette Kellerhoff wrote: >>> Sorry for the impatientness, but I have to solve the problem very soon. >>> The case: >>> - 4841 subjects with multiple record per subject (max 4 records) >>> - for each subject exists a weight, which identifies the real abundance >>> pattern in time >>> >>> I used the following do-file: >>> gen des =tfin~=ti >>> >>> gen tf = tfin-tstart+1 >>> >>> gen org=1+2*(spell-1) >>> replace des=org >>> replace des=org+1 if tfin<ti >>> gen tfc=tstart if spell==1 >>> replace tfc=tfc[_n-1] if spell~=1 & hhnrakt==hhnrakt[_n-1] >>> gen tsp = tstart-tfc >>> gen tfp = tfin-tfc+1 >>> stset tfp [fweight=gew] [ ,id(hhnrakt) f(des=2 4 6 8 10 12) exit(time .)] Richard Herron >>> Jette, can you provide a reproducible example? That may help diagnose >>> your problem. Can you reproduce the error with -sysuse- data or >>> provide your console output, please? On Thu, Mar 22, 2012 at 14:34, Jette Kellerhoff <jettek82@aol.com> wrote: >>>> how to deal with weights according to survival data analysis? If I use >>>> fweights according to stset command, I get the error message "too many >>>> weights". Does anyone have any suggestions? * * 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/

**Follow-Ups**:**AW: AW: AW: st: error message "too many weights"***From:*"Jette Kellerhoff" <jettek82@aol.com>

**AW: AW: AW: st: error message "too many weights"***From:*"Jette Kellerhoff" <jettek82@aol.com>

**References**:**st: error message "too many weights"***From:*"Jette Kellerhoff" <jettek82@aol.com>

**Re: st: error message "too many weights"***From:*Richard Herron <richard.c.herron@gmail.com>

**AW: st: error message "too many weights"***From:*"Jette Kellerhoff" <jettek82@aol.com>

**Re: AW: st: error message "too many weights"***From:*Steve Samuels <sjsamuels@gmail.com>

**AW: AW: st: error message "too many weights"***From:*"Jette Kellerhoff" <jettek82@aol.com>

**Re: AW: AW: st: error message "too many weights"***From:*Steve Samuels <sjsamuels@gmail.com>

**AW: AW: AW: st: error message "too many weights"***From:*"Jette Kellerhoff" <jettek82@aol.com>

**Re: AW: AW: st: error message "too many weights"***From:*Nick Cox <njcoxstata@gmail.com>

**AW: AW: AW: st: error message "too many weights"***From:*"Jette Kellerhoff" <jettek82@aol.com>

**Re: AW: AW: st: error message "too many weights"***From:*Nick Cox <njcoxstata@gmail.com>

**AW: AW: AW: st: error message "too many weights"***From:*"Jette Kellerhoff" <jettek82@aol.com>

**Re: AW: AW: st: error message "too many weights"***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**Re: st: How to find extreme values** - Next by Date:
**Re: st: Stata code for scoring KDQOL-SF, version 1.3** - Previous by thread:
**Re: AW: AW: st: error message "too many weights"** - Next by thread:
**AW: AW: AW: st: error message "too many weights"** - Index(es):