################ ###Exercice 1### ################ #Q1 ?ts ts(1:10, frequency = 4, start = c(1959,2)) print(ts(1:10, frequency = 7, start = c(12, 2)), calendar = TRUE) gnp <- ts(cumsum(1 + round(rnorm(100), 2)),start = c(1954, 7), frequency = 12) plot(gnp) ?diff diff(1:10) length(diff(1:10)) diff(1:10,2) length(diff(1:10,2)) diff(1:10,2,2) diff(c(2,3,5,1,6)) diff(c(2,3,5,1,6),2) #Q2 #Q3 euro50 <- read.csv("...\\tableeurom.csv", header = TRUE, sep = ",", quote = "\"") euro50 <- read.csv(file.choose(), header = TRUE, sep = ",", quote = "\"") #Q4 euro50 str(euro50) # 346 observations de 7 variables euro50[,7] #Q5 ts50 <- ts(euro50) dl50 <- diff(log(ts50[,7])) #Q6 plot(dl50) qqnorm(dl50/sd(dl50)) qqline(dl50/sd(dl50),col=2) ################ ###Exercice 2### ################ #Q1 # Lecture de la table pluie pluie <- read.table("...\\pluie1.txt",header=T) pluie #Q2 # Creation de la serie temporelle stpl <- ts(pluie$pluie,start=1950,freq=12) # 12 observations par pas de temps (annee) str(stpl) #Q3 # Graphe de tspl par mois plot(stpl) # Graphe de tspl par annee plot(aggregate(stpl,1,sum)) ############### ##Exercice 3### ############### #Q1 x <- rnorm(1000) x #Q2 plot(1:1000,x, type = "p", col = "red") acf(x) #Q3 qqnorm(x) qqline(x, col = 2) #Q4 install.packages("tseries") library(tseries) ?jarque.bera.test jarque.bera.test(x) #Q5 shapiro.test(x) #Q6 par(mfrow=c(3,2)) x <- NULL for (i in 1:6){ x <- ts(rnorm(500)) acf(x) }