|
|||||
|
TOC | Introduction | Basics | Prefixes | Parameters | Group-By | Summative | Links | e-mail
Summative Methods: Average, Sum, Count, Maximum, Minumum, and Replace.There are three levels of summative methods which increase in power and complexity: season-to-date short cuts, general summative methods, and keyed summative methods. Each is explained below.Season-to-Date Short Cuts SDQL provides short cuts to season-to-date averages and sums: for the team these are tA and tS and for the opponent these are oA and oS. Here are a few examples of season to date summatives using these short cuts:
To see how NFL teams do after week 5 when they average more than twice as many passing
yards as their opponent use the SDQL:
To see how NBA teams do when they have more than 50 wins
while their opponent has fewer than 30 use the SDQL:
General Summative Methods
The SDQL short cut tA(points) expands out to Average(points@team and season).
This is read, "The average points for each team and season". The text to the right of the
'@' sign defines the conditions under which the average is taken and can be any valid SDQL condition.
For example, to query on NBA teams at home with a home court season-to-date
average score of 110 points or more use the SDQL:
To add the requirement that at least 20 home games have been played use the SDQL:
The general summative methods also allow comparison with league averages.
To see how teams do when they average 50% more three pointers than the league average
and requiring that the team has played at least 30 games use the SDQL:
In addition to conditional averaging, SDQL also allows constraints on the number of games.
To see how teams in the NBA do after averaging at least 130 points
in their last three at home use the SDQL:
General Summative Methods with Keys
The SDQL Average(points@team and season) expands fully out to
Average(points@team and season)[team and season].
This is read "Average points for each team and season evaluated at that team and season".
The most common use of this long form is to check for results from previous seasons.
For example, to see how NFL teams do in week 1 after losing 10 or more games in the previous season
use the SDQL:
Note that whatever conditions are to the right of the `@` sign must appear in the same order
within the square brackets.
To see how teams do in week 1 after winning 8 games at home during the previous regular season use the SDQL:
If one of the terms in the square bracket is a list of values then the summative method is taken over that list. To see how teams do in week 1 after winning at least 15 home games during the previous two regular seasons use the SDQL:
The use of lists inside of the square bracket is also useful for strength-of-opponent queries.
To see how NFL teams do in week 4 after having faced opponents who are still winless use the SDQL:
Note here how the Python method `range` is used to take the Sum over weeks
to isolate games where a team is playing an opponent
they lost to in their previous meeting to suffer their first defeat of
the season.
The Maximum and Minumum methods are useful for checking a team's recent performance.
To see how NBA teams do after scoring at least 100 points 20 games in a row use the SDQL:
TOC | Introduction | Basics | Prefixes | Parameters | Group-By | Summative | Links | e-mail |
|||||
|