additional information on Twitter, #casseroles, #ggi, #manifsencours or #loi78 among many others.
Tag - Montréal
Thursday, May 24 2012
Nightlife in Montreal
By arthur charpentier on Thursday, May 24 2012, 15:13 - on souffle un peu
Tuesday, May 3 2011
Playing with robots
By arthur charpentier on Tuesday, May 3 2011, 09:21 - Informatique / R
My son would be extremely proud if I tell him I can spend hours building robots. Well, my robots are not as fancy as Dr Tenma's, but they usually do what I ask them to do. For instance, it is extremely simple to build a robot with R, to extract data from websites. I have mentioned it here (one tennis matches), but it failed there (on NY Marathon). To illustrate the use of robots, assume that one wants to build his own dataset to study prices of airline tickets. First, we have to choose a departure city (e.g. Paris) and an arrival city (e.g. Montreal). Then, one wants to look at all possible dates from April first (I ran it last month) till the end of December (so we create a vector with all leaving dates, namely a vector for the day, one for the month, and one for the year). Then, we choose a return date (say 3 days after).
DEP="Paris"
ARR="Montreal"
DATE1D=rep(c(1:30,1:31,1:30,1:31,1:31,1:30,1:31,1:30,
1:31,1:31,1:29),3)
DATE1M=rep(c(rep(4,30),rep(5,31),rep(6,30),rep(7,31),
rep(8,31),rep(9,30),rep(10,31),rep(11,30),rep(12,31),
rep(1,31),rep(2,29)),3)
DATE1Y=rep(c(rep(2011,30+31+30+31+31+30+31+
30+31+31+28),rep(2012,31+29)),3)
k=3
DATE3D=c((1+k):30,1:31,1:30,1:31,1:31,1:30,1:31,
1:30,1:31,1:31,1:29,1:k)
DATE3M=c(rep(4,30-k),rep(5,31),rep(6,30),rep(7,31),rep(8,31),
rep(9,30),rep(10,31),rep(11,30),rep(12,31),rep(1,31),rep(2,29),
rep(3,k))
DATE3Y=c(rep(2011,30+31+30+31+31+30+31+30+31+
31+28-k),rep(2012,31+29+k))
It is also possible (for a nice robot), to skip all prior dates
skip=max(as.numeric(Sys.Date()-as.Date("2011-04-01")),1)
Then, we need a website where requests can be written nicely (with cities and dates appearing explicitly). Here, I cannot not mention the website that I used since it is stated on the website that it is strictly forbidden to run automatic requests... Anyway, consider a loop create a url address (actually I chose the value of the date randomly, since I had been told that those websites had memory: if you ask too many times for the same thing during a short period of time, prices would go up),
URL=paste("http://www.♦♦♦♦/dest.dll?qscr=fx&flag=q&city1=",
DEP,"&citd1=",ARR,"&",
"date1=",DATE1D[s],"/",DATE1M[s],"/",DATE1Y[s],
"&date2=",DATE3D[s],"/",DATE3M[s],"/",DATE3Y[s],
"&cADULT=1",sep="")
then, we just have to scan the webpage, looking for ticket prices (just looking for some specific names)
page=as.character(scan(URL,what="character"))
I=which(page%in%c("Price0","Price1","Price2"))
if(length(I)>0){
PRIX=substr(page[I+1],2,nchar(page[I+1]))
if(PRIX[1]=="1"){PRIX=paste(PRIX,page[I+2],sep="")}
if(PRIX[1]=="2"){PRIX=paste(PRIX,page[I+2],sep="")}
Here, we have to be a bit cautious, if prices exceed 1000. Then, it is possible to start a statistical study. For instance, if we compare to destination (from Paris), e.g. Montréal and New York, we obtain the following patterns (with high prices during holidays),
It is also possible to run the code twice (here it was run last month, and a couple of days ago), for the same destination (from Paris to Montréal),
Of course, it would be great if I could run that code say every week, to build up a nice dataset, and to study the dynamic of prices...
The problem is that it is forbidden to do this. In fact, on the website, it is mentioned that if we want to extract data (for an academic purpose), it is possible to ask for an extraction. But if we do tell that we study specific prices, data might be biased. So the good idea would be to use several servers, to make several requests, randomly, and to collect them (changing dates and destination). But here, my computing skills - unfortunately - reach a limit....
Friday, March 18 2011
911, jour après jour
By arthur charpentier on Friday, March 18 2011, 02:21 - Statistics






Tuesday, January 25 2011
You find it cold in Montréal ? trust me, it is even worse than what you can imagine...
By arthur charpentier on Tuesday, January 25 2011, 21:35 - Climat
As people say in Montréal, "aujourd'hui, il fait frette".
And I have been surprised recently when some people told my that we would
reach -35°C Sunday evening... I checked around, and I found -25°C on
all weather forecast websites. But nowhere -35°C. I asked some friends,
and they told me that those people were not really looking at the air
temperature (as we observe on the thermometer), but they were looking
at the wind chill, also called "felt air temperature on exposed skin due to the wind" (température ressentie).And indeed, such a quantity does exist, and can be found on the climate.weatheroffice.gc.ca website. There is also a physical background for that quantity. Hence, the windchill is
defined as
is the air temperature (in °C), and
the wind speed (in km/h). Please don't ask me how to interpret this power 0.16 (I already find difficult to explain a square root in an econometric equation). If we look at the past previous days we observe the following observations,
where points on top are temperature, while below we have felt temperature.So, basically, winters are even colder than what you might think..And the story is not over, yet. The same thing holds for summer: if you take into account humidity, summer are even hotter than what you think... There is the humidex,
, defined here as
denotes a dewpoint (see here for more details).That index appeared in the 70's, with a work of Masterson and Richardson entitled a method of quantifying human discomfort due to excessive heat and humidity (published in 1979).By that time, in Canada, on average, 22 people died, per year, because of those excessive heat and humidity. For those interested by the origin of that index, you can have a look here.
Recently, @Annmaria (here) told me that one might expect variance to increase, i.e. maximas should be increasing faster than minimas. I just wonder if this intuition can be related to the fact that more and more people (including some medias) now talk more about felt temperatures than measured temperatures. And if we compare past temperatures to felt temperature we have today, it looks like the difference between extremes is increasing.... Tuesday, September 28 2010
Tiens voilà, la pluie. Ah! quel sale temps. Où est-il l'été ? l'été où est-il ?
By arthur charpentier on Tuesday, September 28 2010, 16:25 - Climat
Dans Les cafards, de Jo Nesbø,
Harry Hole (qui vient d'Oslo pour ceux qui n'ont pas dévoré la série)
s'entend dire à un moment qu'à Bangkok, les discussions quotidiennes portent rarement sur "la pluie et le beau temps"
pour la bonne raison que le climat est assez prévisible à Bangkok (par
contre on parle quotidiennement du trafic routier). J'avais évoqué ici
l'idée reçue que nous avions, sur le fait que le temps à Rennes n'est
pas si changeant que ça. Et je me suis rendu compte depuis que nous
sommes à Montréal que le temps pouvait vraiment changer d'un jour sur l'autre (et encore, paraît-il, je n'ai rien vu).Alors tout d'abord, pour ceux qui en douteraient, la température à Rennes, et à Montréal, ça n'est pas vraiment la même chose,


















