Announcement

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

  • generating a frequency variable & t-test on frequencies

    Hi Everyone,
    I am using Italian Time Use data and I would like to compute the fraction/percentage of people who reported a given activity (i.e. those that spent a positive time on activity X on year y) and then I would like to test if there exist differences between the two years of interest.
    To this end, I have generated a dummy variable for each activity, such that it takes value 1 if time devoted to X is >0 and zero otherwise. Hence my questions are:
    - is there a way to have a variables that tells me the fraction of 1 for a given variable in a given year?
    -Can I perform a t-test on the difference on the fraction of 1 between these two year using test, by(year)?
    Thank you in advance
    Andrea

  • #2
    Hi Andrea,

    It sounds to me like you want to compare two proportions, and not two means (as is the case for t-tests). It sounds like you have measured the proportion of individuals who did activity X (during year Y) and you have it measured for two different years. For this, you will want to do a test of proportions which can be implemented using the Stata command --prtest--. If your data are paired, in other words, if it is the SAME individuals observed in year 1 and year 2, then a paired test (McNemar's) is warranted and can be done using the stats command --mcc--.

    Let me know if this isn't clear or if you need further guidance.

    Comment


    • #3
      Hi Matt,
      thank You a lot for your answer. It is correct what you're saying, I need to test whether the "participation rate" to activity X has changed through the two waves...However I have one time diary for each individual and individuals are NOT the same across the two waves. Furthermore, I computed the frequencies through the command tab. Can I carry out the prtest anyway? Is there another command to compute and store the relative frequencies (especially when the dummy=1)?
      Thank you again

      Comment


      • #4
        HI Andrea,

        If the individuals are not the same across waves you can compare the proportions a number of ways, such as with the Pearson's chi-squared test, Fisher's exact test, Z-test of two proportions...

        See the following code for a toy example:
        Code:
        webuse nhanes2
        tab2 sex diabetes , chi2 exact
        prtest diabetes , by(sex)

        Comment


        • #5
          Hi Matt,
          thank you a lot. I am using the prtest which is what I needed since I can use it with estpost.
          Thank you again
          Andrea

          Comment

          Working...
          X