Hello,
The data set I'm using is a list of all NFL game results. The data is organized in the order of the date they occurred. The data set includes the following relevant variables: the date of the observation, the season (year), the home team, the away team, the home score, the away score, the favorite to win, and the betting spread for the favorite. The purpose of these variables would be to identify winning streaks that teams are on against the betting point-spread. This is for the replication of an existing paper. How would I create the following:
A variable for the overall winning percentage (relative to the spread) of the home team in the current season
A variable for the overall winning percentage (relative to the spread) of the away team in the current season
A variable for the number of times the home team has beaten the spread in its last four games (a number between 0 and 4)
A variable for the number of times the away team has beaten the spread in its last four games (a number between 0 and 4)
I have no problem creating variables that change the beating spread variable for the favorite (provided in the data set) to the spread for the home or away team. However, given the chronological format of the data, I am struggling to find a way to generate a variable based on a particular team's past performance against the spread in that season or in the past 4 observations. Does the data set need to be entirely reformatted?
I will clean a simplified versions of the data and attach it for reference. Any assistance would be greatly appreciated. I'm sure there is a solution, I'm just not sure what it is.
The data set I'm using is a list of all NFL game results. The data is organized in the order of the date they occurred. The data set includes the following relevant variables: the date of the observation, the season (year), the home team, the away team, the home score, the away score, the favorite to win, and the betting spread for the favorite. The purpose of these variables would be to identify winning streaks that teams are on against the betting point-spread. This is for the replication of an existing paper. How would I create the following:
A variable for the overall winning percentage (relative to the spread) of the home team in the current season
A variable for the overall winning percentage (relative to the spread) of the away team in the current season
A variable for the number of times the home team has beaten the spread in its last four games (a number between 0 and 4)
A variable for the number of times the away team has beaten the spread in its last four games (a number between 0 and 4)
I have no problem creating variables that change the beating spread variable for the favorite (provided in the data set) to the spread for the home or away team. However, given the chronological format of the data, I am struggling to find a way to generate a variable based on a particular team's past performance against the spread in that season or in the past 4 observations. Does the data set need to be entirely reformatted?
I will clean a simplified versions of the data and attach it for reference. Any assistance would be greatly appreciated. I'm sure there is a solution, I'm just not sure what it is.