Make Predictions on an elo
Object
# S3 method for elo.run predict(object, newdata, ...) # S3 method for elo.run.regressed predict(object, newdata, regressed = FALSE, ...) # S3 method for elo.run.multiteam predict(object, newdata, ...) # S3 method for elo.glm predict(object, newdata, type = "response", ...) # S3 method for elo.running predict(object, newdata, running = TRUE, ...) # S3 method for elo.markovchain predict(object, newdata, ...) # S3 method for elo.colley predict(object, newdata, ...) # S3 method for elo.winpct predict(object, newdata, ...)
object | An model from which to get predictions. |
---|---|
newdata | A new dataset containing the same variables as the call
that made |
... | Other arguments. |
regressed | See the note on |
type | See |
running | logical, denoting whether to use the running predicted values. Only makes
sense if |
A vector of win probabilities.
Note that the "elo.glm.running"
objects will use a model fit on all the data to predict.
data(tournament) t1 <- head(tournament, -3) t2 <- tail(tournament, 3) results <- elo.run(score(points.Home, points.Visitor) ~ team.Home + team.Visitor, data = t1, k = 20) predict(results) #> [1] 0.5000000 0.5000000 0.5000000 0.5000000 0.4712494 0.5287506 0.5287506 #> [8] 0.4712494 0.5000000 0.5000000 0.5000000 0.5000000 0.5016550 0.4983450 #> [15] 0.4983450 0.5016550 0.5000000 0.5000000 0.5000000 0.5000000 0.5287506 #> [22] 0.5714631 0.4569335 0.5287506 0.5560040 0.5671044 0.5132404 0.5307154 #> [29] 0.5684153 0.5420635 0.4743640 0.4993501 0.5009797 0.4758315 0.4622916 #> [36] 0.5432464 0.4370737 0.5976816 0.5006344 0.4758579 0.5219654 0.3722182 #> [43] 0.4871266 0.4069742 0.4370169 0.5182687 0.3844961 0.4879447 0.5095624 #> [50] 0.3897233 0.5470091 0.4200704 0.3970499 predict(results, newdata = t2) #> [1] 0.5076848 0.4379392 0.5874606 results <- elo.glm(score(points.Home, points.Visitor) ~ team.Home + team.Visitor, data = t1, subset = points.Home != points.Visitor) predict(results) #> 1 2 3 4 5 6 7 8 #> 0.2531029 0.1786407 0.7938802 0.7637434 0.6614671 0.5563559 0.6928515 0.6543741 #> 9 10 11 12 13 14 15 16 #> 0.1112190 0.9514122 0.6822634 0.6654358 0.5384049 0.9298593 0.5738479 0.9524142 #> 17 18 19 20 21 22 23 24 #> 0.5694956 0.9211923 0.9545990 0.8808230 0.6696690 0.9729000 0.4244605 0.8859010 #> 25 26 27 28 29 30 31 32 #> 0.6968958 0.9693763 0.9714558 0.9814906 0.7496476 0.7810671 0.8551242 0.9019272 #> 33 34 35 36 37 38 39 40 #> 0.8589852 0.3706649 0.9892661 0.8529083 0.8430390 0.9081528 0.4652261 0.3655728 #> 41 42 43 44 45 46 47 48 #> 0.4966376 0.8971005 0.8999737 0.8504990 0.2431403 0.9370506 0.6094407 0.2670447 predict(results, newdata = t2) #> 1 2 3 #> 0.8337789 0.5976471 0.9398963 results <- elo.markovchain(score(points.Home, points.Visitor) ~ team.Home + team.Visitor, data = t1, subset = points.Home != points.Visitor, k = 0.7) predict(results) #> 1 2 3 4 5 6 7 8 #> 0.2658740 0.4410746 0.8602036 0.8505769 0.5085418 0.6927541 0.5358962 0.5164899 #> 9 10 11 12 13 14 15 16 #> 0.1983203 0.9041337 0.6656934 0.3824988 0.5070815 0.9458829 0.5344427 0.8922492 #> 17 18 19 20 21 22 23 24 #> 0.6572618 0.9036261 0.8276390 0.8497647 0.7664461 0.9623895 0.3829382 0.7663506 #> 25 26 27 28 29 30 31 32 #> 0.8594995 0.9320965 0.9678308 0.9324653 0.6390877 0.6568427 0.9132689 0.8285467 #> 33 34 35 36 37 38 39 40 #> 0.9107157 0.5360288 0.9778000 0.9462083 0.8454848 0.9137306 0.3840060 0.5681884 #> 41 42 43 44 45 46 47 48 #> 0.5374816 0.8503404 0.8462465 0.7685313 0.2986474 0.9680287 0.6582784 0.4425154 predict(results, newdata = t2) #> 1 2 3 #> 0.6404343 0.7686262 0.9461136 results <- elo.colley(score(points.Home, points.Visitor) ~ team.Home + team.Visitor, data = t1, subset = points.Home != points.Visitor) predict(results) #> 1 2 3 4 5 6 7 8 #> 0.2410819 0.2115671 0.8249491 0.6724597 0.6276343 0.5874256 0.7866000 0.6162443 #> 9 10 11 12 13 14 15 16 #> 0.1237971 0.9444001 0.7027342 0.7146011 0.5171280 0.9407851 0.7007787 0.9471422 #> 17 18 19 20 21 22 23 24 #> 0.6118876 0.9151984 0.9654452 0.8885136 0.6703984 0.9727676 0.4416078 0.9255215 #> 25 26 27 28 29 30 31 32 #> 0.7496418 0.9604191 0.9699335 0.9744831 0.6849933 0.8330959 0.8587540 0.8780109 #> 33 34 35 36 37 38 39 40 #> 0.8645285 0.3762941 0.9864003 0.8036435 0.8125566 0.9053831 0.3921031 0.3638288 #> 41 42 43 44 45 46 47 48 #> 0.4870615 0.8666672 0.8721664 0.8343910 0.2229292 0.8925926 0.5625242 0.2969295 predict(results, newdata = t2) #> 1 2 3 #> 0.7738812 0.4519521 0.9283556 results <- elo.winpct(score(points.Home, points.Visitor) ~ team.Home + team.Visitor, data = t1, subset = points.Home != points.Visitor, k = 0.7) predict(results) #> 1 2 3 4 5 6 7 8 #> 0.2412827 0.2048504 0.8283101 0.7067952 0.6400737 0.5902730 0.7790874 0.6379617 #> 9 10 11 12 13 14 15 16 #> 0.1244012 0.9474582 0.7249991 0.7021356 0.5157306 0.9417119 0.6786588 0.9518339 #> 17 18 19 20 21 22 23 24 #> 0.6143918 0.9152455 0.9635504 0.8982564 0.6588310 0.9730915 0.4654326 0.9219369 #> 25 26 27 28 29 30 31 32 #> 0.7428734 0.9602723 0.9703248 0.9758237 0.6830799 0.8118063 0.8539565 0.8783146 #> 33 34 35 36 37 38 39 40 #> 0.8550947 0.3657450 0.9865211 0.8152018 0.7977457 0.9070989 0.3915881 0.3447775 #> 41 42 43 44 45 46 47 48 #> 0.4905577 0.8671336 0.8681849 0.8433768 0.2233279 0.8992746 0.5408240 0.3007962 predict(results, newdata = t2) #> 1 2 3 #> 0.7825694 0.4682180 0.9227385