[This article was first published on Freakonometrics - Tag - R-english, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
During the workshop on Statistical Methods for Meteorology and Climate Change today (here) I observed that it was still an important question: is climate change affecting only averages, or does it have an impact on extremes ? And since I’ve seen nice slides to illustrate that question, I decided to play again with my dataset to see what could be said about temperature in Paris.
Recall that data can be downloaded here (daily temperature of the XXth century).
tmaxparis=read.table("/temperature/TX_SOUID100124.txt", skip=20,sep=",",header=TRUE) Dmaxparis=as.Date(as.character(tmaxparis$DATE),"%Y%m%d") Tmaxparis=as.numeric(tmaxparis$TX)/10 tminparis=read.table("/temperature/TN_SOUID100123.txt", skip=20,sep=",",header=TRUE) Dminparis=as.Date(as.character(tminparis$DATE),"%Y%m%d") Tminparis=as.numeric(tminparis$TN)/10 Tminparis[Tminparis==-999.9]=NA Tmaxparis[Tmaxparis==-999.9]=NA annee=trunc(tminparis$DATE/10000) MIN=tapply(Tminparis,annee,min) plot(unique(annee),MIN,col="blue",ylim=c(-15,40),xlim=c(1900,2000)) abline(lm(MIN~unique(annee)),col="blue") abline(lm(Tminparis~unique(Dminparis)),col="blue",lty=2) annee=trunc(tmaxparis$DATE/10000) MAX=tapply(Tmaxparis,annee,max) points(unique(annee),MAX,col="red") abline(lm(MAX~unique(annee)),col="red") abline(lm(Tmaxparis~unique(Dmaxparis)),col="red",lty=2)On the plot below, the dots in red are the annual maximum temperatures, while the dots in blue are the annual minimum temperature. The plain line is the regression line (based on the annual max/min), and the dotted lines represent the average maximum/minimum daily temperature (to illustrate the global tendency),
annee=trunc(tminparis$DATE/10000) boxplot(Tminparis~as.factor(annee),ylim=c(-15,10), xlab="Year",ylab="Temperature",col="blue") x=boxplot(Tminparis~as.factor(annee),plot=FALSE) xx=1:length(unique(annee)) points(xx,x$stats[1,],pch=19,col="blue") abline(lm(x$stats[1,]~xx),col="blue") annee=trunc(tmaxparis$DATE/10000) boxplot(Tmaxparis~as.factor(annee),ylim=c(15,40), xlab="Year",ylab="Temperature",col="red") x=boxplot(Tmaxparis~as.factor(annee),plot=FALSE) xx=1:length(unique(annee)) points(xx,x$stats[5,],pch=19,col="red") abline(lm(x$stats[5,]~xx),col="red")Plain dots are average temperature below the 5% quantile for minima, or over the 95% quantile for maxima (again with the regression line),
Finally, an alternative is to remember that we focus on annual maximas and minimas. Thus, Fisher and Tippett theory (mentioned here) can be used. Here, we fit a GEV distribution on a blog of 10 consecutive years. Recall that the GEV distribution is
install.packages("evir") library(evir) Pmin=Dmin=Pmax=Dmax=matrix(NA,10,3) for(s in 1:10){ X=MIN[1:10+(s-1)*10] FIT=gev(-X) Pmin[s,]=FIT$par.ests Dmin[s,]=FIT$par.ses X=MAX[1:10+(s-1)*10] FIT=gev(X) Pmax[s,]=FIT$par.ests Dmax[s,]=FIT$par.ses }The location parameter
To leave a comment for the author, please follow the link and comment on their blog: Freakonometrics - Tag - R-english.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.