cid-harvard / py-ecomplexity

Python package to compute economic complexity and associated variables
MIT License
63 stars 24 forks source link

RCA calculation #18

Closed manapshymyr closed 3 years ago

manapshymyr commented 3 years ago

Hello. Thanks for your great job.

I am confused when you are calculating the RCA.

            num = data_np / np.nansum(data_np, axis=1)[:, np.newaxis]

            loc_total = np.nansum(data_np, axis=0)[np.newaxis, :]
            world_total = np.nansum(loc_total, axis=1)[:, np.newaxis]
            den = loc_total / world_total
            self.rca_t = num / den

Should not it be something like "(product p value/ local_total c)/(product p total/world total) No?

shreyasgm commented 3 years ago

Note that (x/a)/(b/y) = (x/b)/(a/y)

matuteiglesias commented 3 years ago

Also sometimes useful: = x / (a b / y)