Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: football records from league points


From   Kit Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: football records from league points
Date   Sun, 7 Nov 2004 14:25:31 -0500

Victor wrote

then the classification for the seven teams is as follows :

team gamesp~d won tied lost points
G 4 3 1 0 10
Xe 4 3 0 1 9
Xa 4 2 1 1 7
K 4 1 2 1 5
Z 4 1 1 2 4
V 4 0 2 2 2
N 4 0 1 3 1
What I am wondering is whether it is possible to write some program such
that from the observed gamesplayed and points
you could determine the games won and/or tied and/or lost


The following seems to work for the test data (it does not do the sanity checking of Nick's routine). If team Z had four ties, there would not be the right number of opponents who had also registered ties.


capt drop w l t
sum games, mean
local tg = r(N)*r(max)/2
di "total games `tg'"

g w = 0
g l = 0
g t = 0

forv i=1/`=r(N)' {
local g = games[`i']
local p = points[`i']
local mustt = mod(`p',3)
local maxw = int(`p'/3)
qui replace w = `maxw' in `i'
qui replace t = `mustt' in `i'
qui replace l = `g' - `maxw' - `mustt' in `i'
}
su w, mean
local nw = r(sum)
su l, mean
local nl = r(sum)
su t, mean
local nt = r(sum)
local stat = `nw'+`nl'+`nt'
di "total W + L + T = `stat' should be 2* `tg'"
di "total W = `nw' should equal total L = `nl'"
di "total T = `nt' should be divisible by 2"

l, sep(7)


Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index