I have panel data in long format, grouped by ID & Age (in days). Additionally, I have a Price at each Age & a Dummy that is time-invariant for a given ID.
1.) For each Age, I want to calculate (a) the average price of games where dummy=1 & (b) the average price of games where dummy=0.
2.) I then want to plot these 2 price-averages over age.
I am unsure what the best approach is. Potentially reshape in a way that I have all prices at a given age in one observation?
I'd appreciate the help very much!
Note: The Dummy and the Price can contain a few missing data points.
Data example:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long ID float price_log byte Dummy float age_days 33220 2.995232 0 1 33220 2.995232 0 2 33220 2.995232 0 3 33220 2.995232 0 4 33220 2.995232 0 5 33220 2.995232 0 6 33220 2.995232 0 7 33220 2.995232 0 8 33220 2.994231 0 9 33220 2.994231 0 10 33220 2.994231 0 11 33220 2.994231 0 12 33220 2.995232 0 13 33220 2.995232 0 14 33220 2.995232 0 15 33220 2.995232 0 16 33220 2.995232 0 17 33220 2.995232 0 18 33220 2.995232 0 19 33220 2.995232 0 20 33220 2.995232 0 21 33220 2.995232 0 22 33220 2.995232 0 23 33220 2.995232 0 24 33220 2.995232 0 25 33220 2.995232 0 26 33220 2.995232 0 27 33220 2.995232 0 28 33220 2.995232 0 29 33220 2.995232 0 30 33220 2.995232 0 31 33220 2.995232 0 32 33220 2.995232 0 33 33220 2.995232 0 34 33220 2.995232 0 35 33220 2.995232 0 36 33220 2.995232 0 37 33220 2.995232 0 38 33220 2.995232 0 39 33220 2.995232 0 40 33220 2.995232 0 41 33220 2.995232 0 42 33220 2.995232 0 43 33250 2.3015845 1 1 33250 2.3015845 1 2 33250 2.3015845 1 3 33250 2.3015845 1 4 33250 2.3015845 1 5 33250 2.3015845 1 6 33250 2.3015845 1 7 33250 2.3015845 1 8 33250 2.3015845 1 9 33250 2.3015845 1 10 33250 2.3015845 1 11 33250 2.3015845 1 12 33250 2.3015845 1 13 33250 2.3015845 1 14 33250 2.3015845 1 15 33250 2.3015845 1 16 33250 2.3015845 1 17 33250 2.3015845 1 18 33250 2.3015845 1 19 33250 2.3015845 1 20 33250 2.3015845 1 21 33250 2.3015845 1 22 33250 2.3015845 1 23 33250 2.3015845 1 24 33250 2.3015845 1 25 33250 2.3015845 1 26 33250 2.3015845 1 27 33250 2.3015845 1 28 33250 2.3015845 1 29 33250 2.3015845 1 30 33250 2.3015845 1 31 33250 2.3015845 1 32 33250 2.3015845 1 33 33250 2.3015845 1 34 33250 2.3015845 1 35 33250 2.3015845 1 36 33250 2.3015845 1 37 33250 2.3015845 1 38 33250 2.3015845 1 39 33250 2.3015845 1 40 33250 2.3015845 1 41 33250 2.3015845 1 42 33250 2.3015845 1 43 33250 2.3015845 1 44 33250 2.3015845 1 45 33250 2.3015845 1 46 33250 2.3015845 1 47 end
0 Response to Averages depending on dummy-value (RESHAPE?)
Post a Comment