**Freakonometrics - Tag - R-english**, and kindly contributed to R-bloggers)

I will be in Lyon next Monday to give a talk on “* Modeling heat-waves: return period for non-stationary extremes*” in a workshop entitled “

*Changement climatique et gestion des risques*“. An interesting reference might be some pages from Le Monde (2010). The talk will be more a discussion about modeling series of temperatures (daily temperatures). A starting point might be the IPCC Third Assessment graph (on the left) which illustrates the effect on extreme temperatures when

(a) the mean temperature increases, (b) the variance increases, and (c)

when both the mean and variance increase for a normal distribution of temperature.

I will add here some code used to generate some graphs I will comment. The graph below it the daily minimum temperature,

TEMP=read.table("http://freakonometrics.blog.free.fr/

public/data/TN_STAID000038.txt",header=TRUE,sep=",") D=as.Date(as.character(TEMP$DATE),"%Y%m%d") T=TEMP$TN/10 day=as.POSIXlt(D)$yday+1 an=trunc(TEMP$DATE/10000) plot(D,T,col="light blue",xlab="Minimum daily temperature in Paris",ylab="",cex=.5) abline(R,lwd=2,col="red")

We can clearly see an increasing linear trend. But we do not care

(too much) here about the increase of the average temperature, but more

dispersion, and tails. Here are decenal box-plots

or quantile-regressions

library(quantreg) PENTESTD=PENTE=rep(NA,99) for(i in 1:99){ R=rq(T~D,tau=i/100) PENTE[i]=R$coefficients[2] PENTESTD[i]=summary(R)$coefficients[2,2] } m=lm(T~D)$coefficients[2] plot((1:99)/100,(PENTE/m-1)*100,type="b") segments((1:99)/100,((PENTE-2*PENTESTD)/m-1)*100, (1:99)/100,((PENTE+2*PENTESTD)/m-1)*100, col="light blue",lwd=3) points((1:99)/100,(PENTE/m-1)*100,type="b") abline(h=0,lty=2,col="red")

In order to get a better understanding of the graph above, here are

slopes of quantile regressions associated to different probabilities,

The annualized maxima (of minimum temperature, i.e. warmest night of the year)

i.e. the regression of yearly maximas.

tail index of a Generalized Pareto distribution

Instead of looking at observation over a century (the trend is obviously linear), we can focus on seaonal behavior,

B=data.frame(Y=rep(T,3),X=c(day,day-365,day+365),

A=rep(an,3)) library(quantreg) library(splines) Q50=rq(Y~bs(X,10),data=B,tau=.5) Q95=rq(Y~bs(X,10),data=B,tau=.95) Q05=rq(Y~bs(X,10),data=B,tau=.05) YP95=predict(Q95,newdata=data.frame(X=1:366)) YP05=predict(Q05,newdata=data.frame(X=1:366)) I=(T>predict(Q95))|(T<predict(Q05)) YP50=predict(Q50,newdata=data.frame(X=1:366)) plot(day[I],T[I],col="light blue",cex=.5) lines(1:365,YP95[1:365],col="blue") lines(1:365,YP05[1:365],col="blue") lines(1:365,YP50[1:365],col="blue",lwd=3)

with on red series from 1900 till 1920, and on purple from 1990 till 2010. If we remove the linear trend, and the seasonal cycle, here are the residuals, assume to be stationary,

on during the year

Obviously, something has been missed,

The graph below is the volatility of the residual series, within the year,

Instead of looking at volatility, we can focus on tails, with tail index per month,

mois=as.POSIXlt(D)$mon+1 Pmax=Dmax=matrix(NA,12,2) for(s in 1:12){ X=T3[mois==s] FIT=gpd(X,5) Pmax[s,1:2]=FIT$par.ests Dmax[s,1:2]=FIT$par.ses } plot(1:12,Pmax[,1],type="b",col="blue",

ylim=c(-.6,0)) segments(1:12,Pmax[,1]+2*Dmax[,1],1:12,Pmax[,1]- 2*Dmax[,1],col="light blue",lwd=2) points(1:12,Pmax[,1],col="blue") text(1:12,rep(-.5,12),c("JAN","FEV","MARS", "AVR","MAI","JUIN","JUIL","AOUT","SEPT", "OCT","NOV","DEV"),cex=.7)

At the end of the talk, I will also mention multiple city models, e.g. Paris and Marseilles,

If we look at residuals (once we have removed the linear trend and the seasonal cycle) we observe some positive dependence

In order to study (strong) tail dependence, define

for lower left tail and

and

It looks like there is no tail dependence (in the uper tail). But it is also possible to study weaker tail dependence, through

and

Slides can be visualized below, I will upload them soon,

**leave a comment**for the author, please follow the link and comment on his blog:

**Freakonometrics - Tag - R-english**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...