Announcement

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

  • Looking for advice on computing the difference between two variables with different scales to compute a third variable

    Hello

    I was hoping someone could help me with the below query, if so it would be greatly appreciated:
    • I have two variables with separate scales/metrics: (i) self-report extroversion (possible score of 1-5); (ii) friends report of extroversion (possible score of 1-8)
    • I would like to calculate the meaningful difference between "self-report extroversion" and "friends report of extroversion" for each participant in my sample but I need the two variables to be on the same scale to do this. (I would like to create a new variable based on this difference called "extroversion congruence").
    • Would anybody be able to advise me on the best way to handle the above in stata?
    • I hope this makes sense but if not I am happy to clarify
    Thank you very much

    All the best
    Conal

  • #2
    Conal:
    I cannot say if your approach makes sense in your research field.
    If you have already excluded correlation and regression as feasible tools to investgate what you're interested in, perhaps you can standardize your variables:
    Code:
    quietly sum self_report_extroversion
    g self_report_extroversion_score=(self_report_extroversion-r(mean))/r(sd)
    quietly sum friends_report_extroversion
    g friends_report_extroversion_score=(friends_report_extroversion-r(mean))/r(sd)
    g diff=self_report_extroversion_score-friends_report_extroversion_score
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you very much Carlo, I will try this standardization procedure.

      I previously tried the correlation approach but had difficulty in generating the "extroversion congruence" variable (i.e. the difference between self-report and friend-report extroversion) for each individual participant (which is what I wish to do) - STATA generated missing values when I tried the below code:

      Code:
      egen corr_ext = corr(self-report_ext friend_ext), by (id)
      I also tried the below code; but STATA filled in the same mean correlation in each row (where as I wanted to generate separate correlations at the individual level, for each row/id)

      Code:
      egen corr_ext = corr(self-report_ext friend_ext)
      If pursuing the correlation approach, would anyone be able to advise me where I have went wrong in the coding? Many thanks again for your help!


      All the best
      Conal

      Comment


      • #4
        Conal:
        you cannot get correlation of two variables with one observation each, as you can see from the following example:
        Code:
        .
        . sysuse auto.dta
        (1978 Automobile Data)
        
        . corr price mpg in 1
        insufficient observations
        r(2001);
        
        . corr price mpg
        (obs=74)
        
                     |    price      mpg
        -------------+------------------
               price |   1.0000
                 mpg |  -0.4686   1.0000
        Conversely, I was not able to find -corr- function under -egen-.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thank you again Carlo, yes that makes sense. My further reading informs me that about 5 observations each are probably needed for a correlation to work.

          Apologies, I should have specified that I installed egenmore which enables the -corr- function (and many other functions for egen)

          All the best
          Conal

          Comment


          • #6
            Also standardization procedure seems to work well - thanks again for that!

            Comment


            • #7
              Conal:
              good to follow FAQ advice about posting where you got user-written programme from. Thanks.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment

              Working...
              X