Announcement

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

  • ICA Calculation (International Competitive Advantage Index)

    Hi all,

    does anyone know how to compute the International Competitive Advantage Index (ICA) in Stata? For example, if we would have the following dataset (Note: It is not in -dataex-, but that is because I do not have this data in Stata yet):
    A B ICA
    1 10 1.25
    1 10 1.25
    1 20 0.83
    1 30 0.83
    2 20 1.67
    2 30 1.67
    3 10 1.25
    3 20 0.83
    3 30 0.83
    3 10 1.25
    If the first two variables are given, I would like to compute variable ICA in Stata. The ICA Index is computes as follows:

    ICA_ab = (C_ab / C_b) / (C_a / C_n)

    where
    C_ab = is the number of observations of variable A for a given observation b of variable B.
    C_b = is the total number of observations b of variable B.
    C_a = is the total number of observations a of variable A.
    C_n = is the total number of observations (number of rows).

    To make this clear, these variables would take on the following values for the first ICA index:
    C_ab = 2 (because the 10 exists twice for all the 1s in variable A)
    C_b = 4 (there are four 10s in variable B)
    C_a = 4 (there are four 1s in variable A)
    C_n = 10 (there are 10 rows)
    Hence, the ICA for the first row computes to 1.25.

    I would appreciate any help. Thank you very much.


  • #2
    I started by using the Stata Data Editor to get your sample data into Stata, and then prepared the following code that should point you in a useful direction.
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte(a b) float ica
    1 10 1.25
    1 10 1.25
    1 20  .83
    1 30  .83
    2 20 1.67
    2 30 1.67
    3 10 1.25
    3 20  .83
    3 30  .83
    3 10 1.25
    end
    generate seq = _n
    by b a, sort: generate C_ab = _N
    by b, sort: generate C_b = _N
    by a, sort: generate C_a = _N
    sort seq
    drop seq
    generate C_n = _N
    generate ICA_ab = (C_ab / C_b) / (C_a / C_n)
    format ICA_ab %9.3f
    Code:
    . list, clean noobs
    
        a    b    ica   C_ab   C_b   C_a   C_n   ICA_ab  
        1   10   1.25      2     4     4    10    1.250  
        1   10   1.25      2     4     4    10    1.250  
        1   20    .83      1     3     4    10    0.833  
        1   30    .83      1     3     4    10    0.833  
        2   20   1.67      1     3     2    10    1.667  
        2   30   1.67      1     3     2    10    1.667  
        3   10   1.25      2     4     4    10    1.250  
        3   20    .83      1     3     4    10    0.833  
        3   30    .83      1     3     4    10    0.833  
        3   10   1.25      2     4     4    10    1.250
    With that said, using dataex to present your sample data saves those who want to help you the effort of creating a Stata dataset on which to try out their code.

    When asking for help with code, always show example data. When showing example data, always use dataex.

    The more you help others understand your problem, the more likely others are to be able to help you solve your problem.

    Comment


    • #3
      Great, thank you! I think I understood what you mean with dataex. I will try to incorporate this in the future.

      Comment

      Working...
      X