Announcement

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

  • Absolute coefficient of variation as a new variable

    Dear Forum Users;

    I have been trying to calculate the absolute coefficient of variation for two different variables and need to keep the results as new variables to be used in the regression.

    The following command seemingly works yet I cannot store the outcome as a variable.


    tabstat var, statistics(n mean cv) by(group_var1)


    Could you please help me about how to keep the results as a new variable?

    I hope my question makes sense to you.

  • #2
    Since the coefficient of variation is the standard deviation divided by the mean, the following might start you in a useful direction.
    Code:
    sort group_var1
    by group_var1: egen m = mean(var)
    by group_var1: egen s = sd(var)
    generate cv = s/m

    Comment


    • #3
      It perfectly worked. Thank you very much, William.

      Comment


      • #4
        #2 and #3 seem to settle the matter, but what is the absolute coefficient of variation? The coefficient of variation isn't obviously useful or well defined unless all values of a variable are positive.

        Comment


        • #5
          Originally posted by Nick Cox View Post
          #2 and #3 seem to settle the matter, but what is the absolute coefficient of variation? The coefficient of variation isn't obviously useful or well defined unless all values of a variable are positive.
          Sorry for the extremely late reply. I've employed the so-called "Eckel Model" to measure income smoothing. The model simply divides the absolute value of variance coefficient change in income from t-1 to t with the absolute value of variance coefficient change in sales from t-1 to t.
          Last edited by OF Buyukkurt; 03 Apr 2021, 13:03.

          Comment


          • #6
            That does not sound the same as the coefficient of variation to me.

            Comment


            • #7
              Originally posted by Nick Cox View Post
              That does not sound the same as the coefficient of variation to me.
              It was my bad then since I couldn't express my question clearly. I tried my best but I think it happened because of the lack of comprehension of the model...
              I thought I've completed the study but I just wonder how you think about the above code. Do you think it serves the purpose?

              Comment

              Working...
              X