cid-harvard / ecomplexity

MIT License
24 stars 6 forks source link

Issues executing the ecomplexity codes #5

Closed chadasmith36 closed 2 years ago

chadasmith36 commented 2 years ago

Hello,

I'm a PhD student at George Mason University. I'm working on two projects where I'm attempting to apply, for the first time, these economic complexity methods, and I hope to do many more of these projects in the future. I'm trying to replicate these codes on the BACI dataset to learn how to apply the methods in Stata before I attempt to apply them to a different dataset, but I'm having a few issues executing the codes.

First, I have a question about the read_cepii.do codes. When I "Convert to observatory ids" and merge on i over 10 million obs. did not match and when I merge on j over 8 million obs. did not match. When I "merge to create the export_value and import_value files" 38 million matched and over 94 million did not match. Is that normal? If not, what kind of number should I expect and what might I be doing wrong?

Second, on the atlas_variables.do file, when I "Create touse variable for loading the data into MATA" and then "quietly levelsof origin_id if `touse'==1, local(LOCATION)" I keep getting an error saying ==1 is an invalid name. I tried a workaround and just generated a complex_country variable, but when I "mata exp_cp = rowshape(exp_long,Ncx)," I keep getting an r(3300) error saying my argument is out of range. I thought it might be because my Stata/BE 17 version didn't allow for a big enough matsize for the matrix, so I purchased the Stata/MP 17 version, but I still can't execute the rowshape command. Perhaps it is something I'm doing wrong earlier in the process, but I cannot figure it out and I'm fast approaching some deadlines.

I'd very much appreciate any help or guidance anyone can provide to help me solve these issues. Or, if anyone knows where I might be able to get some help with executing these codes, I'd appreciate a point in the right direction.

Thanks,

Chad Smith

sbustos commented 2 years ago

Hi Chad, hope you are doing well. The code you are apparently using is very old and I do not remember it very well. From what I see you have two questions: one on the CEPII data and the other on the code used to calculate the complexity variables.

I think it's easy if I share and explain an updated code and data. You can download the trade data shown in the https://atlas.cid.harvard.edu/ from https://atlas.cid.harvard.edu/data-downloads (data similar to that of CEPII). We wrote a stata command to calculate all the complexity measures using. You can install it typing the following in the Stata command line:

net install ecomplexity, from(" https://raw.githubusercontent.com/cid-harvard/ecomplexity/master/") force

See the documentation (help ecomplexity once installed). The code is not difficult to follow. You can open it and modify it for your projects. I’m attaching a stata dofile that explains some of the calculations.

I hope this is helpful. Cheers, s.

On Mon, Dec 6, 2021 at 7:56 AM Chad Smith @.***> wrote:

Hello,

I'm a PhD student at George Mason University. I'm working on two projects where I'm attempting to apply, for the first time, these economic complexity methods, and I hope to do many more of these projects in the future. I'm trying to replicate these codes on the BACI dataset to learn how to apply the methods in Stata before I attempt to apply them to a different dataset, but I'm having a few issues executing the codes.

First, I have a question about the read_cepii.do codes. When I "Convert to observatory ids" and merge on i over 10 million obs. did not match and when I merge on j over 8 million obs. did not match. When I "merge to create the export_value and import_value files" 38 million matched and over 94 million did not match. Is that normal? If not, what kind of number should I expect?

Second, on the atlas_variables.do file, when "Create touse variable for loading the data into MATA" and then quietly "levelsof origin_id if `touse'==1, local(LOCATION)" I keep getting an error saying ==1 is an invalid name. I did a workaround and just generated a complex_country variable, but when I "mata exp_cp = rowshape(exp_long,Ncx)," I keep getting an r(3300) error saying my argument is out of range. I thought it might be because my Stata/BE version of Stata didn't allow for a big enough matsize for the matrix, so I purchased the Stata/MP version, but I still can't execute the rowshape command. Perhaps it is something I'm doing wrong earlier in the process, but I cannot figure it out and I'm fast approaching some dealines.

I'd very much appreciate any help or guidance anyone can provide to help me solve these issues. Or, if anyone knows where I might be able to get some help executing these codes, I'd appreciate a point in the right direction.

Thanks,

Chad Smith

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cid-harvard/ecomplexity/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5ANCH7RU5NKQQJBBAZ2YTUPSJEFANCNFSM5JOKAHNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- CENTER FOR INTERNATIONAL DEVELOPMENT AT HARVARD UNIVERSITY Sebastian Bustos | Growth Lab | Doctoral Fellow Rubenstein 422 Harvard Kennedy School, 79 JFK Street Cambridge, MA 02138 T: 617. 7840177- F: 617.496.8753 @. @.>| www.cid.harvard.edu http://www.cid.harvard.edu*

chadasmith36 commented 2 years ago

Hi Sebastian,

Thanks for the reply and for pointing me in the right direction. I appreciate the explainer do-file as well. I’ll try the new data and code and see how I do. I’ll reach back if I have any further issues.

Thanks,

Chad

chadasmith36 commented 2 years ago

Hi Sebastian,

Sorry, but you said you were attaching a stata dofile to explain some of the calculations, but I don't see the attachment. Can you resend it?

Thanks again,

Chad

sbustos commented 2 years ago

Hi Chad, just checked, and the file was attached. Maybe it is not going through github? Anyways, you can get it using the following link: https://www.dropbox.com/s/1whgrcqv9kuyroe/sample_file_ecomplexity.do?dl=0

On Mon, Dec 6, 2021 at 6:48 PM Chad Smith @.***> wrote:

Hi Sebastian,

Sorry, but you said you were attaching a stata dofile to explain some of the calculations, but I don't see the attachment. Can you resend it?

Thanks again,

Chad

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cid-harvard/ecomplexity/issues/5#issuecomment-987263727, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5ANCCMALB5FFLFJMIYR23UPUVTFANCNFSM5JOKAHNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- CENTER FOR INTERNATIONAL DEVELOPMENT AT HARVARD UNIVERSITY Sebastian Bustos | Growth Lab | Doctoral Fellow Rubenstein 422 Harvard Kennedy School, 79 JFK Street Cambridge, MA 02138 T: 617. 7840177- F: 617.496.8753 @. @.>| www.cid.harvard.edu http://www.cid.harvard.edu*

chadasmith36 commented 2 years ago

Hi Sebastian,

Thanks for your help! I think I know which document you are referring to so that's fine.

But I'm now feeling confused as I don't know which order to execute the new set of do-files. Is there a run_codes.do or other similar doc outlining the order like there was in the beta edition?

Also, I understand the economic complexity concepts from the literature, but for an outsider without a coding background, these coding languages are incredibly esoteric and when I run into a problem or get an error code, I feel lost as to what to do about it. Does the Harvard CID offer any professional services to help researchers understand how to execute the methods? Or do you suggest another resource I can go to? I'm willing to pay for some help at this point.

Thanks, Chad

chadasmith36 commented 2 years ago

Hi Sebastian,

Issue is resolved! Deadlines will be met! I found a resource to help me out!

I wanted to say thanks for responding.

My journey down the ecomplexity path has begun!

Chad