shotperformance: Computes, for each player of a specific team, its performance...

View source: R/shotperformance.R

shotperformanceR Documentation

Computes, for each player of a specific team, its performance measure

Description

Computes, for each player of a specific team, its performance measure

Usage

shotperformance(
  PbP_data,
  player_data,
  team_data,
  shotclock_interval = c(0, 24),
  totaltime = 0,
  score_difference = c(-100, 100),
  shot_type = "field",
  min_shots = 100,
  min_shots_high_pressure = 10,
  verbose = FALSE,
  teams = "all"
)

Arguments

PbP_data

a play-by-play dataframe, previously handled by the functions PbPmanipulation, shotclock and scoredifference

player_data

dataframe containing the boxscore data of all players of a particula season. We need it to know the players who have played at least one match for a team during the season. This dataframe might be substituted by a dataframe which has a column Player containing in each row the name of the players and a second columd Team containing the extended name (e.g. Golden State Warriors) of the team in which the player has played at least one match. If a player has played at least one match for more than one team during the same season, he/she will have a row for each franchise where has played

team_data

dataframe, contains several data regarding the teams in the NBA. Inside this function it is used only to check if team_name corresponds to a team in the NBA. If the teams in the play-by-play data studied are the same as in the 2017-18 season, Tadd (the dataframe contained in the BasketballAnalyzeR package, regarding the 2017-18 season) can be used

shotclock_interval

vector of two numeric values or single numeric value, condition on the value of shotclock of the shots that will be considered

totaltime

vector of two numeric values, condition on the value of score.diff of the shots that will be considered

score_difference

numeric value, condition on the value of totalTime of the shots that will be considered

shot_type

character, the type of shots to be analyzed; available options: "2P", "3P", "FT", "field"

min_shots

minimum value of total shots that a player must have attempted in order to qualify for the computation of the performance statistic

min_shots_high_pressure

minimum value of total shots that a player must have attempted in an high pressure situation in order to qualify for the computation of the performance statistic

verbose

boolean, if TRUE, adds some comments about the computations

teams

character or vector of characters, indicates the teams whose players we want to compute the performance statistics

Value

A dataframe containing, for each player which fulfils the conditions on the minimum number of shots, the value of the overall performance, the performance difference in S, the propensity to shoot in S, the total number of shots and the total number of shots in the high pressure situation defined

Author(s)

Andrea Fox

References

P. Zuccolotto and M. Manisera (2020) Basketball Data Science: With Applications in R. CRC Press.

P. Zuccolotto, M. Manisera and M. Sandri (2018) Big data analytics for modeling scoring probability in basketball: The effect of shooting under high pressure conditions. International Journal of Sports Science & Coaching.

Examples

# We consider the high pressure situation of all shots attempted
# when the shotclock value is below 2 seconds
PbP <- PbPmanipulation(PbP.BDB)
PbP <- scoredifference(PbP_data = PbP, team_name = "GSW", player_data=Pbox, team_data = Tadd)
PbP <- shotclock(PbP_data = PbP, sec_14_after_oreb = FALSE, team_data = Tadd)
shotperformance(PbP_data = PbP, player_data = Pbox, team_data = Tadd,
                shotclock_interval = c(0, 2) , shot_type = "2P")

sndmrc/BasketAnalyzeR documentation built on June 6, 2023, 12:52 a.m.