Announcement

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

  • egenmore stata or egen

    Good day everyone

    I was kindly requesting assistance. I correlated yield and DEM variables and I have around 15000 observations. I would like to find less influential variables that affect the low correlation.

    I’ve tried different methods that I’ve seen on this forum but I think I am not doing something wrong as I get error messages.
    I will appreciate it if someone corrects my code to me.

    egenmore corr1= corr(yield, DEM) , by(fid)

    Error: command egenmore is unrecognized
    FID yield DEM
    0 4.22505 3.613554
    1 5.7904 3.639574
    2 5.98815 3.735786
    3 5.877675 3.751731
    4 6.65555 3.732317
    5 5.9603 3.742209
    6 6.2362 3.7284
    7 6.5016 3.793361
    8 6.66445 3.801543
    9 6.268925 3.847231
    10 6.56635 3.818495
    11 6.302375 3.8284
    12 6.3464 3.842584
    13 6.882575 3.847168
    14 7.026975 3.928738
    15 6.927975 3.931657
    16 5.99775 3.935923
    17 5.9769 3.955251
    18 6.085325 3.938371
    19 6.1305 3.95141
    20 6.4169 3.970702
    21 6.39635 3.998399
    22 6.08975 4.016246
    23 6.349175 4.007195
    24 5.91035 4.012233
    25 5.677625 4.015934
    26 4.93885 4.016912
    27 5.1393 3.996199
    28 5.041175 3.983388
    29 5.416575 3.986725
    30 5.409425 4.020954
    31 5.21225 4.04499
    32 5.399975 4.047986
    33 4.668625 4.067715
    34 4.919425 4.067241
    35 4.54245 4.076788
    36 4.36695 4.077446
    37 4.40215 4.050743
    38 4.654175 4.05063
    39 4.968975 4.045498
    40 5.2284 4.109359
    41 4.456975 4.108246
    42 3.74855 4.047297
    43 4.336725 3.994994
    44 4.17595 4.068776
    45 5.24705 4.134148
    46 5.2088 4.16378
    47 6.084 4.1645
    48 5.6427 4.120104
    49 5.4703 4.098624
    50 5.43955 4.058217
    51 5.20975 3.977072
    52 4.547875 3.980149
    53 4.1893 3.904951
    54 4.258975 3.833583
    55 4.39275 3.840139
    56 4.83865 3.811399
    57 4.3447 3.758291
    58 3.641175 3.681761
    59 3.734675 3.631509
    60 3.552325 3.609142
    61 3.280925 3.507009
    62 3.402725 3.416963
    63 4.019625 3.326922
    64 4.907875 3.28381
    65 4.578975 3.235068
    66 4.171525 3.168867
    67 4.251475 3.144556
    68 4.167225 3.066346
    69 3.9188 3.059794
    70 3.591975 3.016265
    71 1.768 2.791127
    72 1.3077 2.545597
    73 1.27515 2.527058
    74 1.826725 2.763952
    75 2.004775 2.842975
    76 3.1396 2.81416
    77 2.1865 2.748117
    78 5.3409 2.949697
    79 3.8303 2.90294
    80 6.210025 3.081014
    81 5.589075 3.178157
    82 6.31075 3.201829
    83 6.048125 3.231142
    84 5.547775 3.248579
    85 5.40915 3.267068
    86 5.71085 3.320058
    87 5.821 3.422306
    88 6.095875 3.488281
    89 5.88745 3.547491
    90 5.743325 3.578636
    91 6.237175 3.621943
    92 5.8298 3.628169
    93 4.498625 3.6117
    94 3.859825 3.625234
    95 4.5237 3.632873
    96 4.1156 3.659969
    97 5.899825 3.593693
    98 3.507225 3.621556
    99 4.2924 3.602226
    100 7.3091 3.771317
    Last edited by Zara Ruzim; 03 May 2021, 08:40.

  • #2
    What error messages do you get?

    Comment


    • #3
      Error: command egenmore is unrecognized

      Comment


      • #4
        -egenmore- is a user-written command. To use it, you must install it by typing -ssc install egenmore-.

        Comment


        • #5
          You need to install the user written collection egenmore

          Code:
           ssc install egenmore
          and then the command you have in mind is

          Code:
          egen corr1= corr(yield, DEM) , by(fid)


          Originally posted by Zara Ruzim View Post
          Error: command egenmore is unrecognized
          Last edited by Joro Kolev; 03 May 2021, 08:49.

          Comment


          • #6
            -egenmore- is not a command; it is a collection of -egen- functions (more later); second, -egenmore- is users-written and must be downloaded and installed; use -search- or -findit- to find and install; then use the functions within just as you would use any other -egen- function

            Comment


            • #7
              I already installed
              . ssc install egenmore
              checking egenmore consistency and verifying not already installed...
              all files already exist and are up to date.

              Comment


              • #8
                The command to use is
                Code:
                 
                 egen corr1= corr(yield, DEM) , by(fid)

                Comment


                • #9
                  This is a comedy of small errors. The help for egenmore (once installed from SSC) does explain that you call up any of its functions in the usual way with egen, as Rich Goldstein also explains.


                  However, the function corr() won't accept a comma, and it does require prior sorting. Hence this will work

                  Code:
                  sysuse auto
                  bysort rep78 : egen corr = corr(mpg weight)
                  and so I imagine that this will work:

                  Code:
                  bysort fid : egen corr  = corr(yield DEM)

                  Comment


                  • #10
                    I feel compelled to note, however, that if the example data shown in #1 is representative of the entire data set, the results will just be all missing values because fid identifies unique observations. And the correlation between two variables is undefined when there is only one pair observed.

                    Comment


                    • #11
                      #10 Clyde Schechter Well, there you go. I failed to spot that too.

                      But here's the sample. At a wild guess, yield is some crop yield and DEM (Digital Elevation Model???) is surface height above some datum. Small variation in height doesn't rule out controls through moisture and nutrient status and even erosion and deposition.

                      Click image for larger version

Name:	yield_DEM.png
Views:	1
Size:	34.6 KB
ID:	1607514

                      Comment

                      Working...
                      X