pachadotdev/economiccomplexity

Balassa Index

Casoratti opened this issue · 1 comments

Hello. My name is David Casoratti, from Argentina and I really like your package. It help´s me to me a lot time of work. But I have an issue with the Balassa Index. By Default, when i source the code, the output is a Matrix of 1. But When I use the balassa_index with discrete = False, there is no problem.

Coding:

RCA <- balassa_index(
Dataset_From_Stata,
discrete = FALSE,
country = "location_code",
product = "hs_product_code",
value = "export_value")

(Has no problem)

MM <- balassa_index(
Dataset_From_Stata,
country = "location_code",
product = "hs_product_code",
value = "export_value")

(Has Problem)

I have to fix ir with the Following code:

threshold = 1
MM@x[MM@x < threshold] <- 0
MM@x[MM@x > threshold] <- 1

I don´t know if this is a problem mine, or if it is a problem of the code. Because I tried it with another devices, and the problem Continues. Have a Nice Weekend!

hola @Casoratti
lo que puedes hacer es seguir el ejemplo de https://pacha.dev/economiccomplexity/articles/economiccomplexity.html
acabo de revisar y con el caso discreto 0/1 funciona