Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: RE: Myers Blended Index


From   Joe Canner <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: RE: RE: Myers Blended Index
Date   Tue, 5 Nov 2013 21:28:07 +0000

Hmmm...yes, I see that now. 

You can pretty much do it step-by-step following the instructions on that site.  There is just one thing missing (the -matcell- option on the last -tab- command before entering Mata).  Here is the code:

*******
gen lastdigit = mod(age,10)
tab lastdigit [fw=pop]
gen mw = 10
replace mw = age+1 if age < 9
replace mw = 99-age if age > 89
replace mw = 0 if age > 98 
gen combow = pop*mw
tab lastdigit [fw=combow], matcell(blended)
mata
        b = st_matrix("blended")
        f = 100 * b :/ sum(b)           
        sum( abs(f :-10 ) )/2 
 end
***********

You will, of course, need to adjust this to fit your circumstances.

Joe

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Valle, Giuseppina
Sent: Tuesday, November 05, 2013 3:50 PM
To: [email protected]
Subject: st: RE: RE: Myers Blended Index

Hi. Thanks. I have used this information, but unfortunately, the link to the command is not working, and I cannot find a "myers" command elsewhere when looking online.  

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Joe Canner
Sent: Tuesday, November 05, 2013 2:45 PM
To: [email protected]
Subject: st: RE: Myers Blended Index

Since I was intrigued by the question but not familiar with Myers Blended Index, I looked online for information and found the following: http://data.princeton.edu/eco572/digitpref.html which has both a discussion of the issues and a link to a Stata command for calculating the index.

Joe Canner
Johns Hopkins University School of Medicine

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Valle, Giuseppina
Sent: Tuesday, November 05, 2013 3:34 PM
To: [email protected]
Subject: st: Myers Blended Index

Hello. I am trying to examine digit preference in my data looking at number of sexual partners. Number of partners reported in my data range from 1 to 300, though I will likely only keep partners ranging from 1 to 50 ( I only examine those with sexual experience). 

I have used the following code to begin this process. 

gen lastdigit = mod(numpart,10)
tab lastdigit

  lastdigit |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |        595       11.18       11.18
          1 |      1,018       19.13       30.31
          2 |        695       13.06       43.38
          3 |        628       11.80       55.18
          4 |        464        8.72       63.90
          5 |        779       14.64       78.54
          6 |        367        6.90       85.44
          7 |        324        6.09       91.52
          8 |        282        5.30       96.82
          9 |        169        3.18      100.00
------------+-----------------------------------
      Total |      5,321      100.00

So here I can see that there is some preference for 0,1,2,3, and 5. However, now I wish to calculate a Myers Blended Index. Is there code for Stata 12 to produce this or any literature someone can suggest to better understand this?

Thank you in advance.
-Pina


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index