Announcement

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

  • Testing for statistical significance of a trend line or pattern of means in stata

    I have panel data by year covering all years between 2003-2013, and in each year, I calculate mean age at first sex. I then graph these means which reveal a pattern of the age at first sex over time, separately for females and males. I now want to assess if the trend pattern I am observing is statistically different. For variables that are proportions like proportion using condoms, I use ptrend command in stata. But I don't know what to do if its a mean?

    Regards,

    Tinofa

  • #2
    The conventional test of differences between means is ANOVA. So, you could try something like
    Code:
    anova age year##sex
    If the residuals are right skew, then you might wish to consider various generalized linear models, such as
    Code:
    glm age i.year##i.sex, family(gaussian) link(log) nolog
    or
    Code:
    glm age i.year##i.sex, family(poisson) link(log) robust nolog
    or
    Code:
    glm age i.year##i.sex, family(gamma) link(log) nolog
    If you wish to perform a nonparametric test for trend (separately for each sex), then there is the official Stata
    Code:
    nptrend age if sex == "M", by(year)
    nptrend age if sex == "F", by(year)
    and the user-written
    Code:
    jonter age if sex == "M", by(year)
    jonter age if sex == "F", by(year)

    Comment


    • #3
      Dear Joseph,
      after running the command jonter AgeFirstSex if Sex == "MAL", by(SurveillanceYear) I got:
      Jonckheere-Terpstra Test for Ordered Alternatives

      J = 21564583
      J* = 15.766 (corrected for ties)


      Pr(|Z| > |J*|) = 0.0000 (ordered alternative in either direction)
      Pr(Z > J*) = 1.0000 (descending ordered alternative)
      Pr(Z < J*) = 0.0000 (ascending ordered alternative)

      But I neither sure if the command is correct nor how to interpret the results; could you help please?

      Comment


      • #4
        Question asked a long time ago, but it seems to me the command is still an option for investigating non-parametric time trends. In this case, I'd say that, for males, there's overwhelming significance of an increasing time trend of age at first sex.

        Comment

        Working...
        X