shotclock: Computes, for each action, an estimate of the value of the...

View source: R/shotclock.R

shotclockR Documentation

Computes, for each action, an estimate of the value of the shotclock when the action has ended

Description

Computes, for each action, an estimate of the value of the shotclock when the action has ended

Usage

shotclock(
  PbP_data,
  team_data,
  sec_14_after_oreb = FALSE,
  report = FALSE,
  verbose = FALSE,
  seconds_added_after_made_shot = 2,
  max_error_threshold = 4
)

Arguments

PbP_data

a play-by-play dataframe, previously handled by the function PbPmanipulation

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

sec_14_after_oreb

boolean, it indicates if the shotclock has been set to 14 seconds in certain situations. It has to be true if the data have been recorded after the 2018-19 season. The default value is FALSE

report

boolean, if TRUE, the function prints a few details about some data which have a negative value of shotclock (and therefore have been correceted)

verbose

boolean, if TRUE, adds some comments about the computations

seconds_added_after_made_shot

numeric value, after a shot is made the period clock is not stopped (unless it is in the last minutes of each quarter), hence a certain number of seconds has to be added in order to take account of the seconds taken for the inbound pass

max_error_threshold

numeric value, some errors still occur in the data and some negative values of shotclock are produced (in general due to some delay between the end of the action and its registration). This parameters indicates the maximum absolute value of negative shotclock which is arbitrarily fixed to a positive value; the values of shotclock below this threshold are set as NAs

Details

It is necessary that the name of the team is contained in the column corresponding to the description

Value

The play-by-play data, with the additional data regarding the value of shotclock and the boolean indicating whether the action has started with a value of shotclock equal to 14 seconds

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

PbP <- PbPmanipulation(PbP.BDB)
PbP <- shotclock(PbP_data = PbP, team_data = Tadd)

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