I recently read some papers using panel data from sports. I started to wonder how one would actually declear data e.g. from tennis to be panel data.
Typically, in tennis there is a season which consists of several tournaments. In turn, each of these tournaments consists of several matches. Each match consists of a sequence of sets. A set in turn, consists of a sequence games.
So, one observation is for player x from game g in set s of match m played for tournament t in season z. If there are seperate variables indicating the season (e.g. 2015), the tournament (e.g. 1), the match (e.g. 1), the set (e.g. 1), and the game (e.g. 1), how would one declare the data to be panel while keeping the structure described above? I included the code for a sample data set below.
Obviously, the panelvar in the xtset-command would be player_id. But how would one set the timevar if one's goal was to run a panel data regression (e.g. using xtreg) at the game-level which includes time lags (e.g. matchlevelstat1 from the previous match as well as gamelevelstat1 and gamelevelstat2 from the previous game, which might actually be from the same tournament and same match but from the previous set of that match) as independent variables?
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(year player_id tournament match) byte(set game) float(gamelevelstat1 gamelvelstat2 setlevelstat1 matchlevelstat1 tournamentlevelstat1 yearlevelstat1) 2018 1 1 1 1 1 19 19 22 26 57 17 2018 1 1 1 1 2 64 19 100 39 3 47 2018 1 1 1 2 1 100 32 79 93 32 92 2018 1 1 1 2 2 67 70 15 63 82 88 2018 1 1 2 1 1 86 12 83 92 55 50 2018 1 1 2 1 2 67 97 95 93 100 48 2018 1 1 2 2 1 14 53 58 28 26 6 2018 1 2 1 1 1 8 78 6 35 22 41 2018 1 2 1 1 2 87 85 68 55 98 17 2018 1 2 1 2 1 32 56 87 69 40 94 2018 1 2 1 2 2 47 24 42 89 32 99 2018 1 2 2 1 1 16 98 38 85 21 11 2018 1 2 2 1 2 88 1 87 60 96 28 2018 1 2 2 2 1 14 72 50 19 55 14 2019 1 1 1 1 1 34 48 16 38 95 44 2019 1 1 1 1 2 73 6 25 26 93 96 2019 1 1 1 2 1 92 27 48 89 68 99 2019 1 1 1 2 2 62 66 66 27 80 22 2019 1 1 2 1 1 69 46 40 2 90 59 2019 1 1 2 1 2 27 74 55 13 14 73 2019 1 1 2 2 1 11 61 75 26 73 26 2019 1 2 1 1 1 12 43 16 28 58 15 2019 1 2 1 1 2 49 49 91 83 61 35 2019 1 2 1 2 1 71 1 62 90 50 54 2019 1 2 1 2 2 88 53 6 58 40 99 2019 1 2 2 1 1 84 13 33 96 3 30 2019 1 2 2 1 2 79 68 80 18 86 19 2019 1 2 2 2 1 52 5 77 17 36 48 2018 2 1 1 1 1 59 67 5 29 96 22 2018 2 1 1 1 2 89 34 22 69 100 40 2018 2 1 1 2 1 5 74 8 49 97 83 2018 2 1 1 2 2 58 91 44 66 58 62 2018 2 1 2 1 1 96 77 73 53 59 62 2018 2 1 2 1 2 90 38 32 80 2 42 2018 2 1 2 2 1 79 43 90 18 6 1 2018 2 2 1 1 1 49 85 38 25 95 33 2018 2 2 1 1 2 23 35 35 51 9 53 2018 2 2 1 2 1 9 92 49 98 91 44 2018 2 2 1 2 2 78 9 26 81 23 39 2018 2 2 2 1 1 85 13 98 55 8 77 2018 2 2 2 1 2 24 38 75 12 1 53 2018 2 2 2 2 1 65 91 31 49 96 70 2019 2 1 1 1 1 100 38 9 86 15 83 2019 2 1 1 1 2 78 3 94 9 32 26 2019 2 1 1 2 1 73 40 41 62 60 59 2019 2 1 1 2 2 2 30 26 62 78 49 2019 2 1 2 1 1 21 83 58 10 25 16 2019 2 1 2 1 2 63 92 78 4 29 23 2019 2 1 2 2 1 98 67 59 61 82 62 2019 2 2 1 1 1 75 48 72 25 14 64 2019 2 2 1 1 2 87 76 87 98 60 7 2019 2 2 1 2 1 42 40 38 12 61 29 2019 2 2 1 2 2 12 82 72 48 61 59 2019 2 2 2 1 1 35 42 50 24 14 17 2019 2 2 2 1 2 84 73 75 25 25 72 2019 2 2 2 2 1 50 85 79 8 56 52 end label var year "season" label var player_id "player " label var tournament "tournament number" label var match "match number" label var set "set" label var game "game" label var gamelevelstat1 "game-level statistic 1" label var gamelvelstat2 "game-level statistic 2" label var setlevelstat1 "set-level statistic 1" label var matchlevelstat1 "match-level statistic 1" label var tournamentlevelstat1 "tournament-level statistic 1" label var yearlevelstat1 "season-level statistic 1"
0 Response to How to declare data with tournament structure as panel data?
Post a Comment