Announcement

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

  • ECDF and specific observations CD

    I have a list of observations (column retemptionPRS) which based on them I need to calculate the empirical cumulative distribution (ECDF). Now, I have a list of other observations (DIfFROMnav) which for each one I would like to know what is the Cumulative Distribution (based on the the ECDF that I calculated by the retemptionPRS examples). At the end I need to have a new variable that will include the results to the question - for a specific DIfFROMnav (in each line) what is the Cumulative Distribution. What is the best way to do it?
    Attached Files

  • #2
    I think this means that you want to know where values on one variable would fall in the distribution of another variable. This paper may help.


    SJ-21-4 st0656 . . . . . . . . . . . Relative distribution analysis in Stata
    (help reldist if installed) . . . . . . . . . . . . . . . . . B. Jann
    Q4/21 SJ 21(4):885--951
    discusses the method of relative distribution analysis and
    implements various elements of the methodology

    Comment


    • #3
      thanks I couldn't find this paper. can you please help me with that?

      Comment


      • #4
        Hi I found it and review it quickly .I am not sure it can help me. I calculated the ECDF based on variable A. now I need the Y's of each observation in variable B. here I miss the command

        Comment


        • #5
          It is a good idea to want to give us example data. However, we don't want that data as file we download. We don't know you, and downloading files from unknown persons on the internet is for many an unacceptable risk. Ransomware attacks are increasing. For example, a number of universities in Germany are now without internet, without internal network, lost all their work stored on network drives because of such attacks. Some people on this list work in more sensitive areas like hospitals, imagine the damage such an attack could do there. This has happened recently in Germany. Therefore we strongly prefer you use dataex to create such examples. See the FAQ (black bar near the top of this site) and help dataex. I took a calculated risk and downloaded your file and than typed dataex retemptionPRS , count(187) . I copied the result below:


          Code:
          * Example generated by -dataex-. For more info, type help dataex
          clear
          input float retemptionPRS
            -.41901335
            -.09092245
              5.436253
             -1.238135
              .1549885
             .26348716
              5.672412
            -.09833454
             .07935158
             1.6372274
             -.3401744
             1.7120917
             1.8223574
            .070273146
            -.04996895
              .4708686
              .9193526
             1.3930123
           -.028186714
              4.535467
            -.55593574
              .9487383
               1.75052
             -.1130538
             -.1537302
             1.2622715
              .7113628
             -1.847852
              .2729464
             2.5750854
               3.19417
            -.07739413
               1.51134
            -.11679547
             .10323116
             .16432546
                     0
             .03900823
              .2836479
              .5768424
          -.0003905106
             -8.649364
            -.03931253
             4.5436673
             -.3221847
            -1.0906746
             -1.229091
            -.10879515
             .24239317
             .09164272
              .8456338
            -.53323966
              .7048035
              .4811217
                     0
            .017660663
             .10787205
             .18489885
            -.03830093
            -.12371234
              .1731578
              .3971805
             .11692655
             1.6798295
           -.013463285
             .08525685
             .14728342
             .12065248
            -2.4286864
            .019183116
             .10622967
            .070987955
              .3455819
            -.20673026
             .04419509
           -.012034387
             .25114122
                     0
           -.016963098
             .08449313
            -.13313107
              .2107718
              .2284349
             -.8110631
            -.02735607
              .4404541
            -.00594631
              .6013533
             2.2734368
             1.1967243
             .09380972
            -.11699472
           -.016577253
              .1239567
            -.05916986
             1.6384976
              1.609568
              .6265364
             -.2310129
             -.7499086
              .8189748
             .01457395
             -.5117083
              .4491267
             1.7290666
             3.4903064
             .18356985
             .18266246
              .4134256
             -.5964106
             -.3624974
              .5857986
              .8050543
              .3662974
              .3452462
            -1.0777941
             -2.415268
            -1.4147263
              1.267439
            -1.6337912
              .3398682
                     0
             -.3086951
             -1.740236
             -4.403449
              .3650402
              .3011987
              .1692113
              .1113906
              -.484669
              1.865126
            -.08307122
                     0
             1.4511353
              1.432526
             -.3885272
               .298689
              .6662008
                     0
            -.59170556
             -2.411903
            -.14284591
              .8032433
              4.896772
              1.446209
             -.7851094
            -.16358635
            -.56442213
             .53186464
            -.11346567
            -.05382926
            -.03413329
              .1709851
             .07816972
             -2.440471
             2.0794652
             .02999752
               -.11456
             .12339386
             .29452795
             -.2864788
             -.3937802
               .659335
            -.24081987
             -.5097167
             -.5331166
            -.11471998
              .4233168
            -1.6556057
             -.3897363
              .2330282
              .6373766
             -5.791305
             -1.366341
               .175669
                     0
             .27403224
            -.15906122
             -.3124701
            -2.5928555
              .3459025
             -.2391005
            -1.0971327
            -.13938023
            -1.5217745
             -.4814376
              -.529372
          end
          After that you can create a new variable with ECDF using cumul retemptionPRS, gen(ECDF)
          ---------------------------------
          Maarten L. Buis
          University of Konstanz
          Department of history and sociology
          box 40
          78457 Konstanz
          Germany
          http://www.maartenbuis.nl
          ---------------------------------

          Comment


          • #6
            Thanks and I received you comment about downlosind data. However, I managed to calculated the ECDF. based on retemptionPRS. My problem now is to find the Y-ies of DIfFROMnav observations based on the that ECDF. Do you know how to do it? Thanks in advance

            DIfFROMnav retemptionPRS ECDF
            -1.6921 -8.649364 .0053476
            9.5644 -5.791305 .0106952
            4.8584 -4.403449 .0160428
            10.499 -2.592855 .0213904
            7.4199 -2.440471 .026738
            .7059 -2.428686 .0320856
            4.1608 -2.415268 .0374332
            6.0968 -2.411903 .0427807
            -2.4176 -1.847852 .0481283
            4.8071 -1.740236 .0534759
            8.8445 -1.655606 .0588235
            4.2912 -1.633791 .0641711
            11.108 -1.521775 .0695187
            4.2061 -1.414726 .0748663
            10.063 -1.366341 .0802139
            -10.377 -1.238135 .0855615
            -1.1567 -1.229091 .0909091
            10.886 -1.097133 .0962567
            -1.2083 -1.090675 .1016043
            4.1135 -1.077794 .1069519
            1.1613 -.8110631 .1122995
            6.7559 -.7851094 .1176471
            2.8248 -.7499086 .1229947
            3.7391 -.5964106 .1283422
            5.7864 -.5917056 .1336898
            6.8629 -.5644221 .1390374
            -3.5268 -.5559357 .144385
            -.60432 -.5332397 .1497326
            8.3596 -.5331166 .1550802
            11.743 -.529372 .1604278
            3.2818 -.5117083 .1657754
            8.2716 -.5097167 .171123
            5.017 -.484669 .1764706
            11.134 -.4814376 .1818182
            -11.917 -.4190134 .1871658
            7.9105 -.3937802 .1925134
            8.9296 -.3897363 .197861
            5.3647 -.3885272 .2032086
            3.7579 -.3624974 .2085561
            -6.4371 -.3401744 .2139037
            -1.5581 -.3221847 .2192513
            10.29 -.3124701 .2245989
            4.803 -.3086951 .2299465
            7.8335 -.2864788 .2352941
            8.0985 -.2408199 .2406417
            10.872 -.2391005 .2459893
            2.7554 -.2310129 .2513369
            .82044 -.2067303 .2566845
            6.7981 -.1635863 .2620321
            10.237 -.1590612 .2673797
            -3.1059 -.1537302 .2727273
            6.2795 -.1428459 .2780749
            11.086 -.1393802 .2834225
            .99354 -.1331311 .28877
            .36035 -.1237123 .2941177
            2.4745 -.1169947 .2994652
            -2.1348 -.1167955 .3048128
            8.3823 -.11472 .3101604
            7.7034 -.11456 .315508
            7.1662 -.1134657 .3208556
            -3.2008 -.1130538 .3262032
            -1.1516 -.1087952 .3315508
            -7.4429 -.0983345 .3368984
            -11.605 -.0909224 .342246
            5.0686 -.0830712 .3475936
            -2.2325 -.0773941 .3529412
            2.5193 -.0591699 .3582888
            7.2224 -.0538293 .3636364
            -5.4231 -.049969 .368984
            -1.6112 -.0393125 .3743316
            .34733 -.0383009 .3796791
            7.239 -.0341333 .3850267
            -3.905 -.0281867 .3903743
            1.6568 -.0273561 .3957219
            .91188 -.0169631 .4010695
            2.4862 -.0165773 .4064171
            .54492 -.0134633 .4117647
            .84175 -.0120344 .4171123
            2.0075 -.0059463 .4224599
            -1.7542 -.0003905 .4278075
            10.181 0 .4652406
            4.803 0 .4652406
            .8444 0 .4652406
            -1.9722 0 .4652406
            5.134 0 .4652406
            5.6683 0 .4652406
            .28126 0 .4652406
            3.222 .014574 .4705882
            .28126 .0176607 .4759358
            .77528 .0191831 .4812834
            7.5603 .0299975 .486631
            -1.9216 .0390082 .4919786
            .83051 .0441951 .4973262
            -6.1231 .0702731 .5026738
            .79096 .070988 .5080214
            7.3841 .0781697 .513369
            -7.1991 .0793516 .5187166
            .96636 .0844931 .5240642
            .58254 .0852569 .5294118
            -.88333 .0916427 .5347593
            2.4068 .0938097 .540107
            -2.0645 .1032312 .5454546
            .77956 .1062297 .5508021
            .32515 .107872 .5561497
            5.0082 .1113906 .5614973
            .48022 .1169266 .5668449
            .69207 .1206525 .5721925
            7.8041 .1233939 .5775401
            2.5003 .1239567 .5828877
            .61466 .1472834 .5882353
            -10.349 .1549885 .5935829
            -2.047 .1643255 .5989305
            5.007 .1692113 .6042781
            7.3359 .1709851 .6096257
            .42758 .1731578 .6149732
            10.181 .175669 .6203209
            3.5994 .1826625 .6256685
            3.5312 .1835698 .631016
            .3349 .1848989 .6363636
            1.0203 .2107718 .6417112
            1.1356 .2284349 .6470588
            8.9886 .2330282 .6524064
            -1.1084 .2423932 .657754
            .8444 .2511412 .6631016
            -10.252 .2634872 .6684492
            -2.3411 .2729464 .6737968
            10.198 .2740322 .6791444
            -1.8129 .2836479 .684492
            7.8264 .2945279 .6898396
            5.6667 .298689 .6951872
            4.9536 .3011987 .7005348
            4.478 .3398682 .7058824
            4.0415 .3452462 .7112299
            .79713 .3455819 .7165775
            10.844 .3459025 .7219251
            4.953 .3650402 .7272727
            3.9725 .3662974 .7326203
            .46962 .3971805 .7379679
            3.6093 .4134256 .7433155
            8.4118 .4233168 .7486631
            1.9783 .4404541 .7540107
            3.3083 .4491267 .7593583
            -5.4066 .4708686 .7647059
            -.12479 .4811217 .7700534
            7.1296 .5318646 .7754011
            -1.7888 .5768424 .7807487
            3.7893 .5857986 .7860963
            2.0933 .6013533 .7914438
            2.6623 .6265364 .7967914
            9.3548 .6373766 .802139
            8.0016 .659335 .8074867
            5.6683 .6662008 .8128342
            -.48075 .7048035 .8181818
            -2.6885 .7113628 .8235294
            6.3341 .8032433 .828877
            3.9205 .8050543 .8342246
            2.9822 .8189748 .8395722
            -.86467 .8456338 .8449198
            -4.7169 .9193526 .8502674
            -3.5023 .9487383 .855615
            2.3774 1.196724 .8609626
            -2.9655 1.262272 .8663102
            4.2748 1.267439 .8716577
            -3.95 1.393012 .8770053
            5.3069 1.432526 .8823529
            6.665 1.446209 .8877006
            5.134 1.451135 .8930481
            -2.2042 1.51134 .8983957
            2.6384 1.609568 .9037433
            -7.0235 1.637227 .9090909
            2.5485 1.638498 .9144385
            .5167 1.679829 .9197861
            -6.3593 1.712092 .9251337
            3.35 1.729067 .9304813
            -3.4491 1.75052 .9358289
            -6.3233 1.822357 .9411765
            5.0655 1.865126 .9465241
            7.4819 2.079465 .9518716
            2.3562 2.273437 .9572192
            -2.283 2.575085 .9625669
            -2.236 3.19417 .9679145
            3.4524 3.490306 .973262
            -3.677 4.535467 .9786096
            -1.5625 4.543667 .9839572
            6.4192 4.896772 .9893048
            -11.452 5.436253 .9946524
            -7.4653 5.672412 1

            Comment


            • #7
              I don't understand what you want to do. Can you clarify?
              ---------------------------------
              Maarten L. Buis
              University of Konstanz
              Department of history and sociology
              box 40
              78457 Konstanz
              Germany
              http://www.maartenbuis.nl
              ---------------------------------

              Comment


              • #8
                Thanks for your reply Maarten.
                At the end I want to find for each observation of the DIFFFROMNAV, value the percentage of cases which the redemptions are below that number. For example, for a DIFFFROM nav above 5.67 I will be protected for 100% of the cases of redemptions. For DIFfromNAV between 5.67- 5.43 I will be protected only for 99.4% and so on. I need to put for each DIFfromNAv the relevant percentage . I hope that I made it clearer. thanks again

                Comment

                Working...
                X