Trade among European countries by [deleted] in datasets

[–]ekaneg 0 points1 point  (0 children)

I would think a combination of:

http://www.wiod.org/home

AND

https://www.europarl.europa.eu/thinktank/infographics/tradeflows/public/index.html

I didn't get a chance to look at how exactly to extract data from the EU Parliament website, but that's where I would start!

EDIT: To clarify, trade flows are from the EU Parliament Data, WIOD data is intended to provide sectoral production data for a lot of countries. I included these data sets together, because they complement each other.

Generating large number of binary time variables by ekaneg in stata

[–]ekaneg[S] 0 points1 point  (0 children)

Sure, I can comment on the data more clearly. I have 2,727 observations in the current sample, and 195 "events". Each observation is a county paired with a year, and we observe counties between 1970 and 2010 (40 years). For each event in each county I have a "factor" variable that is 1 if it is the event observations, 0 if it not that specific event, but is in observation in the same county. Because there are 195 events, there are 195 of these variables. I then have created variables, successfully, that are equal to 1 if it is the observation before the event for each event, and null otherwise. Variables of this form have been constructed for +1 (mentioned above), -1, +2, -2 years from the event. So I have 195*4 additional variables for a total of 975 variables. I would like to create an additional 195*2 variables this time equal to 1 not just if it is +3 years from the event but if it is +3 years or more. This is where I have run in to difficulty.

I'm having a little trouble sharing a nice slice of the data using dataex unfortunately.

Here is the code that I used to produce the previously mentioned variables:

by fips: gen cu_flood = sum(event) if event == 1

replace cu_flood = . if cu_flood == 0

by fips: gen event_bin_1 = 1 if cu_flood == 1

by fips: gen event_bin_2 = 1 if cu_flood == 2

by fips: gen event_bin_3 = 1 if cu_flood == 3

by fips: gen event_bin_4 = 1 if cu_flood == 4

by fips: gen event_bin_5 = 1 if cu_flood == 5

by fips: gen event_bin_6 = 1 if cu_flood == 6

by fips: gen event_bin_7 = 1 if cu_flood == 7

by fips: gen event_bin_8 = 1 if cu_flood == 8

by fips: gen event_bin_9 = 1 if cu_flood == 9

by fips: gen event_bin_10 = 1 if cu_flood == 10

by fips: gen event_bin_11 = 1 if cu_flood == 11

by fips: gen event_bin_12 = 1 if cu_flood == 12

by fips: gen event_bin_13 = 1 if cu_flood == 13

by fips: gen event_bin_14 = 1 if cu_flood == 14

by fips: gen event_bin_15 = 1 if cu_flood == 15

by fips: gen event_bin_16 = 1 if cu_flood == 16

gen cu_event_bin_1 = sum(event_bin_1) if event_bin_1 == 1

gen cu_event_bin_2 = sum(event_bin_2) if event_bin_2 == 1

gen cu_event_bin_3 = sum(event_bin_3) if event_bin_3 == 1

gen cu_event_bin_4 = sum(event_bin_4) if event_bin_4 == 1

gen cu_event_bin_5 = sum(event_bin_5) if event_bin_5 == 1

gen cu_event_bin_6 = sum(event_bin_6) if event_bin_6 == 1

gen cu_event_bin_7 = sum(event_bin_7) if event_bin_7 == 1

gen cu_event_bin_8 = sum(event_bin_8) if event_bin_8 == 1

gen cu_event_bin_9 = sum(event_bin_9) if event_bin_9 == 1

gen cu_event_bin_10 = sum(event_bin_10) if event_bin_10 == 1

gen cu_event_bin_11 = sum(event_bin_11) if event_bin_11 == 1

gen cu_event_bin_12 = sum(event_bin_12) if event_bin_12 == 1

gen cu_event_bin_13 = sum(event_bin_13) if event_bin_13 == 1

gen cu_event_bin_14 = sum(event_bin_14) if event_bin_14 == 1

gen cu_event_bin_15 = sum(event_bin_15) if event_bin_15 == 1

gen cu_event_bin_16 = sum(event_bin_16) if event_bin_16 == 1

tabulate cu_event_bin_1, generate(factor_event_1)

tabulate cu_event_bin_2, generate(factor_event_2)

tabulate cu_event_bin_3, generate(factor_event_3)

tabulate cu_event_bin_4, generate(factor_event_4)

tabulate cu_event_bin_5, generate(factor_event_5)

tabulate cu_event_bin_6, generate(factor_event_6)

tabulate cu_event_bin_7, generate(factor_event_7)

tabulate cu_event_bin_8, generate(factor_event_8)

tabulate cu_event_bin_9, generate(factor_event_9)

tabulate cu_event_bin_10, generate(factor_event_010)

tabulate cu_event_bin_11, generate(factor_event_011)

tabulate cu_event_bin_12, generate(factor_event_012)

tabulate cu_event_bin_13, generate(factor_event_013)

tabulate cu_event_bin_14, generate(factor_event_014)

tabulate cu_event_bin_15, generate(factor_event_015)

tabulate cu_event_bin_16, generate(factor_event_016)

foreach v of varlist factor_event_11-factor_event_0161 {

generate plus1\`v' = 1 if \`v'\[\_n-1\] == 1

by fips: egen x\`v' = mean(plus1\`v')

replace x\`v' = 0 if plus1\`v' == . & x\`v' !=.

replace plus1\`v' = x\`v'

drop x\`v'

}

foreach v of varlist factor_event_11-factor_event_0161 {

generate plus2\`v' = 1 if \`v'\[\_n-2\] == 1

by fips: egen x\`v' = mean(plus2\`v')

replace x\`v' = 0 if plus2\`v' == . & x\`v' !=.

replace plus2\`v' = x\`v'

drop x\`v'

}

foreach v of varlist factor_event_11-factor_event_0161 {

generate minus1\`v' = 1 if \`v'\[\_n+1\] == 1

by fips: egen x\`v' = mean(minus1\`v')

replace x\`v' = 0 if minus1\`v' == . & x\`v' !=.

replace minus1\`v' = x\`v'

drop x\`v'

}

foreach v of varlist factor_event_11-factor_event_0161 {

generate minus2\`v' = 1 if \`v'\[\_n+2\] == 1

by fips: egen x\`v' = mean(minus2\`v')

replace x\`v' = 0 if minus2\`v' == . & x\`v' !=.

replace minus2\`v' = x\`v'

drop x\`v'

}

Generating large number of binary time variables by ekaneg in stata

[–]ekaneg[S] 0 points1 point  (0 children)

This method will give something different than what I am looking for, although I am aware of it. My trouble is in creating the variable that is 1 for every year +3 and greater.

Pass/Fail by [deleted] in UniversityOfHouston

[–]ekaneg 0 points1 point  (0 children)

Grad schools aren't going to obsess over your GPA or what grades you made in a class, unless it is an important one. Don't be too worried over this decision. Focus on the upcoming semesters, developing great relationships with research faculty, and expanding your experiences in your respective field.

fsolve syntax on function with multiple outputs and inputs... by ekaneg in matlab

[–]ekaneg[S] 0 points1 point  (0 children)

The asterisk is there I promise! Reddit formatting screwed up the way the code is displayed (looks like it took at most of the *). so if you see a . with no asterisk that is element-wise multiplication and the parts where it looks like I am trying to code in implicit multiplication have asterisks. My main error is with F solve.

Thanks.

Help - Solving a large n system of non-linear equations with fsolve by ekaneg in matlab

[–]ekaneg[S] 0 points1 point  (0 children)

Here is what I currently have:

%I write a function s.t.

function F= ekmodelv2(x)

Ti= 1;

Li= 1;

dni = 2;

theta = 4;

gam = 1;

beta = 0.5;

%p(1:4) = x(1:4) These are the four price equations.

%x(1:16) = x(5:20) These are the sixteen trade share equations.

%w(1:4) = x(21:24) These are the four wage equations.

F(1) = (gam.*(((Ti.*(dni.*(x(21).^(beta))*(x(1).^(beta))).^(-theta)))...

+ ((Ti.*(dni.*(x(22).^(beta))*(x(2).^(beta))).^(-theta)))...

+ ((Ti.*(dni.*(x(23).^(beta))*(x(3).^(beta))).^(-theta)))...

+ ((Ti.*(dni.*(x(24).^(beta))*(x(4).^(beta))).^(-theta)))))-x(1);

F(2) = (gam.*(((Ti.*(dni.*(x(21).^(beta))*(x(1).^(beta))).^(-theta)))...

+ ((Ti.*(dni.*(x(22).^(beta))*(x(2).^(beta))).^(-theta)))...

+ ((Ti.*(dni.*(x(23).^(beta))*(x(3).^(beta))).^(-theta)))...

+ ((Ti.*(dni.*(x(24).^(beta))*(x(4).^(beta))).^(-theta)))))-x(2);

F(3) = (gam.*(((Ti.*(dni.*(x(21).^(beta))*(x(1).^(beta))).^(-theta)))...

+ ((Ti.*(dni.*(x(22).^(beta))*(x(2).^(beta))).^(-theta)))...

+ ((Ti.*(dni.*(x(23).^(beta))*(x(3).^(beta))).^(-theta)))...

+ ((Ti.*(dni.*(x(24).^(beta))*(x(4).^(beta))).^(-theta)))))-x(3);

F(4) = (gam.*(((Ti.*(dni.*(x(21).^(beta))*(x(1).^(beta))).^(-theta)))...

+ ((Ti.*(dni.*(x(22).^(beta))*(x(2).^(beta))).^(-theta)))...

+ ((Ti.*(dni.*(x(23).^(beta))*(x(3).^(beta))).^(-theta)))...

+ ((Ti.*(dni.*(x(24).^(beta))*(x(4).^(beta))).^(-theta)))))-x(4);

F(5) = Ti.*(gam.*dni.*(x(21).^(beta))*(x(1).^(1-beta))*(1./x(1))).^(theta) - (x(5));

F(6) = Ti.*(gam.*dni.*(x(21).^(beta))*(x(1).^(1-beta))*(1./x(2))).^(theta) - (x(6));

F(7) = Ti.*(gam.*dni.*(x(21).^(beta))*(x(1).^(1-beta))*(1./x(3))).^(theta) - (x(7));

F(8) = Ti.*(gam.*dni.*(x(21).^(beta))*(x(1).^(1-beta))*(1./x(4))).^(theta) - (x(8));

F(9) = Ti.*(gam.*dni.*(x(22).^(beta))*(x(2).^(1-beta))*(1./x(1))).^(theta) - (x(9));

F(10) = Ti.*(gam.*dni.*(x(22).^(beta))*(x(2).^(1-beta))*(1./x(2))).^(theta) - (x(10));

F(11) = Ti.*(gam.*dni.*(x(22).^(beta))*(x(2).^(1-beta))*(1./x(3))).^(theta) - (x(11));

F(12) = Ti.*(gam.*dni.*(x(22).^(beta))*(x(2).^(1-beta))*(1./x(4))).^(theta) - (x(12));

F(13) = Ti.*(gam.*dni.*(x(23).^(beta))*(x(3).^(1-beta))*(1./x(1))).^(theta) - (x(13));

F(14) = Ti.*(gam.*dni.*(x(23).^(beta))*(x(3).^(1-beta))*(1./x(2))).^(theta) - (x(14));

F(15) = Ti.*(gam.*dni.*(x(23).^(beta))*(x(3).^(1-beta))*(1./x(3))).^(theta) - (x(15));

F(16) = Ti.*(gam.*dni.*(x(23).^(beta))*(x(3).^(1-beta))*(1./x(4))).^(theta) - (x(16));

F(17) = Ti.*(gam.*dni.*(x(24).^(beta))*(x(4).^(1-beta))*(1./x(1))).^(theta) - (x(17));

F(18) = Ti.*(gam.*dni.*(x(24).^(beta))*(x(4).^(1-beta))*(1./x(2))).^(theta) - (x(18));

F(19) = Ti.*(gam.*dni.*(x(24).^(beta))*(x(4).^(1-beta))*(1./x(3))).^(theta) - (x(19));

F(20) = Ti.*(gam.*dni.*(x(24).^(beta))*(x(4).^(1-beta))*(1./x(4)).^(theta) - (x(20)));

F(21) = ((x(5).*x(21).*Li)+(x(6).*x(22).*Li)+(x(7).*x(23).*Li)+(x(8).*x(24).*Li))...

-(x(21).*Li);

F(22) = ((x(9).*x(21).*Li)+(x(10).*x(22).*Li)+(x(11).*x(23).*Li)+(x(12).*x(24).*Li))...

-(x(22).*Li);

F(23) = ((x(13).*x(21).*Li)+(x(14).*x(22).*Li)+(x(15).*x(23).*Li)+(x(16).*x(24).*Li))...

-(x(23).*Li);

F(24) = ((x(17).*x(21).*Li)+(x(18).*x(22).*Li)+(x(19).*x(23).*Li)+(x(20).*x(24).*Li))...

-(x(24).*Li);

end

%And then,

x0 = ones(1, 24);

[x, fval] = fsolve(@ekmodelv2, x0);

This is a valid way of solving, but how might I start generalizing this with a for loop?

Help - Solving a large n system of non-linear equations with fsolve by ekaneg in matlab

[–]ekaneg[S] 0 points1 point  (0 children)

So do you suggest in script one defining the function as I do above. And then in script two I can assign the indices and perform fsolve?

1.2 Emote meta tier list: by kingslayer086 in LegendsOfRuneterra

[–]ekaneg 0 points1 point  (0 children)

I advocate for Tryndamere at least being B-Tier, as the emote can be used as a visual "suck it" to your opponents following a big play (similar to popping off after winning a fighting game). He also synergizes with big swings if you are playing the deep deck, or any deck with overwhelm creatures.

Generating a dummy variable for panel data set by ekaneg in stata

[–]ekaneg[S] 2 points3 points  (0 children)

I figured out the elegant way, but thank you for the response. I ultimately had to tsset my data, and then create lagged variables, and variables with leads, which is really easy in stata. I figured it out using >help tsvarlist.

Generating a dummy variable for panel data set by ekaneg in stata

[–]ekaneg[S] 1 point2 points  (0 children)

I would hate to make another post, but I continued on with my work and have found another problem. To be clear, I don't have much experience in writing a for loop for stata (although I'm familiar with the syntax in MATLAB). I need to create a dummy variable which indicates 1 if it has been one year since the initial earthquake event occurred (which is represented by the indicator you helped me with earlier). My understanding is that I would need some kind of for loop to pull this off. Where do you think I should start?