Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • xtset

    I would like to see what effect treatment has on patient reported outcomes. i have made a varialbe "visitnumber" which is unique for each patient visit, but may vary in time, from patient to patient. (for example: visit 2 may be 2 weeks after visit 1 in a patient, and 3 months after visit 1 in another.) i was using xtset to analyze this, but a friend of mine pointed out that xtset uses fixed time intervals (1 month, 6 months, 1 year, etc.). is this true? if so, is there another way of analyzing data using visitnumber?

  • #2
    No, that's quite wrong, or rather misleading. xtset respects whatever you declare as the time variable and you can use whatever you like, subject to some small uniqueness and other constraints. There is no rule or expectation of regular spacing. However, what bites is that other commands which require a prior xtset or tsset will often not perform well or as you would hope given irregular spacing.

    It's for you to decide whether and for what purposes sequence number is a natural or at least convenient metric for time.

    Comment


    • #3
      The -xtset- command simply designates variables as the i() and t() variables for use by other xt- commands. -xtset- by itself doesn't really care if your intervals are equal. Some -xt- commands require equal intervals (e.g. the various -xt- regressions will require this if you specify an auto-regressive correlation structure). But those command check this themselves.

      So, I don't think you have a problem at this point.

      Comment


      • #4
        From the xtset help:

        In the first syntax -- xtset panelvar -- the data are set to be a panel and the order
        of the observations within panel is considered to be irrelevant.
        If you don't care about the timing of the visits at all, just use xtset without a time variable.

        If the order of the visits is important but not the time interval between them, then you can use visitnumber as the time variable and trick xtset into thinking it is a proper time variable. Again from the xtset help:

        timevar will often simply be a variable that counts 1, 2, ..., and is to be
        interpreted as first year of survey, second year, ..., or first month of treatment,
        second month, .... In these cases, you do not need to specify a unitoption.
        This will technically work, since xtset doesn't know that your visits aren't really at equal intervals, but you have to be careful how you do your analysis and how you interpret the results.

        Comment


        • #5
          This is an interesting cultural difference by the way.

          For some groups of researchers, it is just standard that data come regularly spaced, although most of those people rely on the labours of some reporting office and a few standard and non-standard lies for regular spacing to be plausible and achieved.

          For other groups of researchers, society or nature does its level best to ensure that births, job changes, revolutions, strikes, earthquakes, floods, eruptions, and so forth are as irregular as caprice can make them.

          Release dates of Stata versions are somewhere in between.

          Comment

          Working...
          X