[R] Olympics: 200m Men Final
Mohan Radhakrishnan
mohanr at fss.co.in
Fri Aug 10 07:45:49 CEST 2012
Hi,
Can't we use these predictions based on statistical principles
for predicting payment gateway usages, transaction flows etc. ?
Sometimes our gateways fails and there could be a mean-time between
failures.
Is there a certain roadmap( book ? ) for learning this type of
prediction ? We are novice capacity planners.
Thanks,
Mohan
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Rui Barradas
Sent: Friday, August 10, 2012 1:54 AM
To: r-help
Subject: [R] Olympics: 200m Men Final
Hello,
Have you seen the log-linear prediction of the 100m winning time in R
mailed to the list yesterday by David Smith, subject Revolutions Blog:
July roundup?
"A log-linear regression in R predicted the gold-winning Olympic 100m
sprint time to be 9.68 seconds (it was actually 9.63 seconds):
http://bit.ly/QfChUh"
The original by Markus Gesmann can be found at
http://lamages.blogspot.pt/2012/07/london-olympics-and-prediction-for-10
0m.html
I've made the same, just changing the address to the 200m historical
data, and the predicted time was 19.27. Usain Bolt has just made 19.32.
If you want to check it, the address and the 'which' argument are:
url <-
"http://www.databasesports.com/olympics/sport/sportevent.htm?sp=ATH&enum
=120"
Plus a change in the graphic functions' y axis arguments to allow for
times around the double to be ploted and seen.
#
# Original by Markus Gesmann:
#
http://lamages.blogspot.pt/2012/07/london-olympics-and-prediction-for-10
0m.html
library(XML)
library(drc)
url <-
"http://www.databasesports.com/olympics/sport/sportevent.htm?sp=ATH&enum
=120"
data <- readHTMLTable(readLines(url), which=3, header=TRUE)
golddata <- subset(data, Medal %in% "GOLD")
golddata$Year <- as.numeric(as.character(golddata$Year))
golddata$Result <- as.numeric(as.character(golddata$Result))
tail(golddata,10)
logistic <- drm(Result~Year, data=subset(golddata, Year>=1900), fct =
L.4())
log.linear <- lm(log(Result)~Year, data=subset(golddata, Year>=1900))
years <- seq(1896,2012, 4)
predictions <- exp(predict(log.linear, newdata=data.frame(Year=years)))
plot(logistic, xlim=c(1896,2012),
ylim=range(golddata$Result) + c(-0.5, 0.5),
xlab="Year", main="Olympic 100 metre",
ylab="Winning time for the 100m men's final (s)")
points(golddata$Year, golddata$Result)
lines(years, predictions, col="red")
points(2012, predictions[length(years)], pch=19, col="red")
text(2012 - 0.5, predictions[length(years)] - 0.5,
round(predictions[length(years)],2))
Rui Barradas
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
DISCLAIMER:\ ===============...{{dropped:30}}
More information about the R-help
mailing list