0

NBA Per-game stats

Please forgive me if this issue has been addressed already. I did a forum search and didn't come across what I was looking for.

As I'm doing statistical analysis on players, I'm realizing I need per-game stats to unlock the next level of prediction (since I want to try things like sampling from a distribution or using percentiles). I can get average performance per game by dividing total by games played, but that's very sensitive to outlier performances (Kevin Love, anyone? ;-)).

I realize that I can filter down the stat query to a particular timetable, like day or week. But then I would also need to combine that with the player's schedule, and now we're talking a lot of queries/complexity. Is there an easy way in one or two queries to get the equivalent of a player's game log?
http://sports.yahoo.com/nba/players/3084/g...51oLmafJ80VPKB4

thanks for your help!

by
6 Replies
  • QUOTE (John D @ Nov 18 2010, 03:09 PM) <{POST_SNAPBACK}>
    Please forgive me if this issue has been addressed already. I did a forum search and didn't come across what I was looking for.

    As I'm doing statistical analysis on players, I'm realizing I need per-game stats to unlock the next level of prediction (since I want to try things like sampling from a distribution or using percentiles). I can get average performance per game by dividing total by games played, but that's very sensitive to outlier performances (Kevin Love, anyone? ;-)).

    I realize that I can filter down the stat query to a particular timetable, like day or week. But then I would also need to combine that with the player's schedule, and now we're talking a lot of queries/complexity. Is there an easy way in one or two queries to get the equivalent of a player's game log?
    http://sports.yahoo.com/nba/players/3084/g...51oLmafJ80VPKB4

    thanks for your help!


    I don't have a response, but am another person that's looking for the same information. Hope there's an easy way to do this!
    0
  • QUOTE (John D @ Nov 18 2010, 03:09 PM) <{POST_SNAPBACK}>
    Please forgive me if this issue has been addressed already. I did a forum search and didn't come across what I was looking for.

    As I'm doing statistical analysis on players, I'm realizing I need per-game stats to unlock the next level of prediction (since I want to try things like sampling from a distribution or using percentiles). I can get average performance per game by dividing total by games played, but that's very sensitive to outlier performances (Kevin Love, anyone? ;-)).

    I realize that I can filter down the stat query to a particular timetable, like day or week. But then I would also need to combine that with the player's schedule, and now we're talking a lot of queries/complexity. Is there an easy way in one or two queries to get the equivalent of a player's game log?
    http://sports.yahoo.com/nba/players/3084/g...51oLmafJ80VPKB4

    thanks for your help!

    Ah, yeah, that's a really interesting request. As it stands right now, we unfortunately don't have a good process for requesting multiple stat views in the same request. We've put some work into it already, but there are some outstanding performance issues that go along with it that we're a bit worried about. For right now, I'd recommend trying to work with the stats data that's already been aggregated (requesting stats types of "season", "lastmonth", "lastweek", etc) and trying to normalize from there, or, yeah, making more requests to pull the data down (but keeping in mind that you'll hit rate limits eventually, so you'll want to try to minimize how much information you're actually trying to pull out).
    0
  • Thanks for your reply, please keep me posted if/when this kind of thing is available. I'm thinking my solution in the meantime will be to set up a local DB instance and write some code to query and cache the per-day stats slowly to stay under the rate limit.
    0
  • QUOTE (John D @ Nov 29 2010, 11:46 PM) <{POST_SNAPBACK}>
    Thanks for your reply, please keep me posted if/when this kind of thing is available. I'm thinking my solution in the meantime will be to set up a local DB instance and write some code to query and cache the per-day stats slowly to stay under the rate limit.


    John - What query are you using to grab historical stats? Or are you only caching per day stats going forward? I'm trying to track player stats over time (also shoving them in a local db). I have data for the last week or so that I've been doing this but I'm trying to figure out how I can recreate stats for the prior dates. Any suggestions?
    0
  • I'm using the following query string:
    http://fantasysports.yahooapis.com/fantasy/v2/game/nba/players;start=offset/stats;type=date;date=yyyy-MM-dd

    That definitely took me awhile to figure out... it's not obvious from the documentation. So I step through one day at a time, grabbing 25 players at a time (the max allowed per query), waiting a long time to make sure I don't start throwing 999 exceptions. My OAuth cert expires in 1 hour (unfortunately you need that even if you're not doing league-specific stuff), so I had to restart it several times but I was able to fetch all the daily data back to like 2003 over the holidays. Also note that the game code (in the above case "nba") is only good for 2010-2011 season dates, you need to use the correct game code here for prior seasons. Playoffs and preseason game days will return empty data sets. Wikipedia is a good source for when each season starts and begins (for example http://en.wikipedia.org/wiki/2006%E2%80%9307_NBA_season) so that you don't waste time querying days guaranteed to have no games.
    0
  • QUOTE (John D @ Jan 5 2011, 10:50 PM) <{POST_SNAPBACK}>
    I'm using the following query string:
    http://fantasysports.yahooapis.com/fantasy/v2/game/nba/players;start=offset/stats;type=date;date=yyyy-MM-dd

    That definitely took me awhile to figure out... it's not obvious from the documentation. So I step through one day at a time, grabbing 25 players at a time (the max allowed per query), waiting a long time to make sure I don't start throwing 999 exceptions. My OAuth cert expires in 1 hour (unfortunately you need that even if you're not doing league-specific stuff), so I had to restart it several times but I was able to fetch all the daily data back to like 2003 over the holidays. Also note that the game code (in the above case "nba") is only good for 2010-2011 season dates, you need to use the correct game code here for prior seasons. Playoffs and preseason game days will return empty data sets. Wikipedia is a good source for when each season starts and begins (for example http://en.wikipedia.org/wiki/2006%E2%80%9307_NBA_season) so that you don't waste time querying days guaranteed to have no games.


    DUDE. YOU. ARE. THE. MAN.

    Thanks so much for that epically fast response!
    0

Recent Posts

in Fantasy Sports API