setwd("H:/MES DOCUMENTS/Mes sites Web/monsiteweb2/LivreEconometrie/programmes/R") getwd() library(tseries) library(car) library(dynlm) library(strucchange) library(mFilter) ## lecture des données chap5<-read.table("chapitre5R.csv",head=TRUE,sep=";" ) head(chap5)## visualise les premières observations chap5t<-ts(data = chap5, start = 1970, end = 1998, frequency =4,deltat = 1 ) chap5t[,"pib_fr"] #Problème n°1 : Evaluation par simulation ## question 1a - creation des variables cpibga glissement annuel du pib pibga_fr<-100*diff(chap5t[,"pib_fr"], lag=4)/(lag(chap5t[,"pib_fr"],-4)) pibga_dm<-100*diff(chap5t[,"pib_dm"], lag=4)/(lag(chap5t[,"pib_dm"],-4)) pibga_nl<-100*diff(chap5t[,"pib_nl"], lag=4)/(lag(chap5t[,"pib_nl"],-4)) pibga_es<-100*diff(chap5t[,"pib_es"], lag=4)/(lag(chap5t[,"pib_es"],-4)) pibga_it<-100*diff(chap5t[,"pib_it"], lag=4)/(lag(chap5t[,"pib_it"],-4)) pibga_uk<-100*diff(chap5t[,"pib_uk"], lag=4)/(lag(chap5t[,"pib_uk"],-4)) ## question 1b - creation des variables ccpibga glissement annuel de cpib cpiga_fr<-100*diff(chap5t[,"cpi_fr"], lag=4)/(lag(chap5t[,"cpi_fr"],-4)) cpiga_dm<-100*diff(chap5t[,"cpi_dm"], lag=4)/(lag(chap5t[,"cpi_dm"],-4)) cpiga_nl<-100*diff(chap5t[,"cpi_nl"], lag=4)/(lag(chap5t[,"cpi_nl"],-4)) cpiga_es<-100*diff(chap5t[,"cpi_es"], lag=4)/(lag(chap5t[,"cpi_es"],-4)) cpiga_it<-100*diff(chap5t[,"cpi_it"], lag=4)/(lag(chap5t[,"cpi_it"],-4)) cpiga_uk<-100*diff(chap5t[,"cpi_uk"], lag=4)/(lag(chap5t[,"cpi_uk"],-4)) ## question 1c ecinf_fr<-cpiga_fr-2 ecinf_dm<-cpiga_dm-2 ecinf_nl<-cpiga_nl-2 ecinf_es<-cpiga_es-2 ecinf_it<-cpiga_it-2 ecinf_uk<-cpiga_uk-2 hp_fr<-hpfilter(chap5t[,"pib_fr"],freq=1600) hp_dm<-hpfilter(chap5t[,"pib_dm"],freq=1600) hpt_nl<-hpfilter(chap5t[29:113,"pib_nl"],freq=1600) hpt_nl<-hpfilter(chap5t[29:113,"pib_nl"],freq=1600) ## problème des NA hp_nl<-ts(hpt_nl$trend, start = 1977, end = 1998, frequency =4,deltat=1) hp_es<-hpfilter(chap5t[,"pib_es"],freq=1600) hp_it<-hpfilter(chap5t[,"pib_it"],freq=1600) hp_uk<-hpfilter(chap5t[,"pib_uk"],freq=1600) hpga_fr<-100*diff(hp_fr$trend, lag=4)/lag(hp_fr$trend,-4) hpga_dm<-100*diff(hp_dm$trend, lag=4)/lag(hp_dm$trend,-4) hpga_nl<-100*diff(hp_nl, lag=4)/lag(hp_nl,-4) hpga_es<-100*diff(hp_es$trend, lag=4)/lag(hp_es$trend,-4) hpga_it<-100*diff(hp_it$trend, lag=4)/lag(hp_it$trend,-4) hpga_uk<-100*diff(hp_uk$trend, lag=4)/lag(hp_uk$trend,-4) gap_fr<-100*(chap5t[,"pib_fr"]-hp_fr$trend)/ hp_fr$trend gap_dm<-100*(chap5t[,"pib_dm"]-hp_dm$trend)/ hp_dm$trend gap_nl<-100*(chap5t[,"pib_nl"]-hp_nl)/ hp_nl gap_es<-100*(chap5t[,"pib_es"]-hp_es$trend)/ hp_es$trend gap_it<-100*(chap5t[,"pib_it"]-hp_it$trend)/ hp_it$trend gap_uk<-100*(chap5t[,"pib_uk"]-hp_uk$trend)/ hp_uk$trend c=c("blue","red") ts.plot(chap5t[,"pib_dm"],hp_dm$trend,main="allemagne",col=c) legend("topleft",c("pib_dm","hp_dm"),col=c,lty = c(1,1)) ts.plot(pibga_dm,hpga_dm,main="allemagne",col=c) legend("topleft",c("pibga_dm","hpga_dm"),,col=c,lty = c(1, 1)) ts.plot(gap_dm,cpiga_dm,main="allemagne",col=c) legend("topleft",c("gap_dm","gap_dm"),col=c,lty = c(1, 1)) ##Question 2 ## taux de taylor ts_fr<-hpga_fr+cpiga_fr+0.5*ecinf_fr+0.5*gap_fr ts_dm<-hpga_dm+cpiga_dm+0.5*ecinf_dm+0.5*gap_dm ts_nl<-hpga_nl+cpiga_nl+0.5*ecinf_nl+0.5*gap_nl ts_es<-hpga_es+cpiga_es+0.5*ecinf_es+0.5*gap_es ts_it<-hpga_it+cpiga_it+0.5*ecinf_it+0.5*gap_it ts_uk<-hpga_uk+cpiga_uk+0.5*ecinf_uk+0.5*gap_uk ## taux neutre tn_fr<-hpga_fr+cpiga_fr tn_dm<-hpga_dm+cpiga_dm tn_nl<-hpga_nl+cpiga_nl tn_es<-hpga_es+cpiga_es tn_it<-hpga_it+cpiga_it tn_uk<-hpga_uk+cpiga_uk c=c("blue","red","black") ts.plot(chap5t[,"tc_dm"],tn_dm,ts_dm,main="allemagne",col=c) legend("topright",c("tc_dm","tn_dm","ts_dm"),col=c,lty = c(1,1, 1)) #difference taux neutre taux court ec_fr = (chap5t[,"tc_fr"]-tn_fr) ec2_fr = ec_fr**2 ec_dm= (chap5t[,"tc_dm"]-tn_dm) ec2_dm = ec_dm**2 ec_nl=(chap5t[,"tc_nl"]-tn_nl) ec2_nl = ec_nl**2 ec_es = (chap5t[,"tc_es"]-tn_es) ec2_es = ec_es**2 ec_it = (chap5t[,"tc_it"]-tn_it) ec2_it = ec_it**2 ec_uk = (chap5t[,"tc_uk"]-tn_uk) ec2_uk = ec_uk**2 # precision de la regle de taylor simulée cas 1 rmsec_fr<-ts(start = c(1973,4), end = 1998, frequency =4,deltat=1) for(i in 1:98){ j=i+11 rmsec_fr[i:i]=sqrt(mean(ec2_fr[i:j]))} rmsec_dm<-ts(start = c(1973,4), end = 1998, frequency =4,deltat=1) for(i in 1:98){ j=i+11 rmsec_dm[i:i]=sqrt(mean(ec2_dm[i:j]))} rmsec_dm rmsec_nl<-ts(start = c(1980,4), end = 1998, frequency =4,deltat=1) for(i in 1:81){ j=i+11 rmsec_nl[i:i]=sqrt(mean(ec2_nl[i:j]))} rmsec_nl rmsec_es<-ts(start = c(1973,4), end = 1998, frequency =4,deltat=1) for(i in 1:98){ j=i+11 rmsec_es[i:i]=sqrt(mean(ec2_es[i:j]))} rmsec_es rmsec_it<-ts(start = c(1973,4), end = 1998, frequency =4,deltat=1) for(i in 1:98){ j=i+11 rmsec_it[i:i]=sqrt(mean(ec2_it[i:j]))} rmsec_it rmsec_uk<-ts(start = c(1973,4), end = 1998, frequency =4,deltat=1) for(i in 1:98){ j=i+11 rmsec_uk[i:i]=sqrt(mean(ec2_uk[i:j]))} c=c("black","orange","yellow","blue","red","green") ts.plot(rmsec_fr,rmsec_dm,rmsec_it,rmsec_uk,rmsec_es,rmsec_nl, main="precision de la regle de taylor simulée cas 1", col=c) legend("topright",c("rmsec_fr","rmsec_dm","rmsec_it","rmsec_uk","rmsec_es","rmsec_nl"), col=c,lty = c(1,1,1,1,1,1)) #difference taux court et taux de taylor er2_fr = (chap5t[,"tc_fr"]-ts_fr)**2 er2_dm = (chap5t[,"tc_dm"]-ts_dm)**2 er2_nl = (chap5t[,"tc_nl"]-ts_nl)**2 er2_es = (chap5t[,"tc_es"]-ts_es)**2 er2_it = (chap5t[,"tc_it"]-ts_it)**2 er2_uk = (chap5t[,"tc_uk"]-ts_uk)**2 # precision de la regle de taylor simulée cas2 rmsee_fr<-ts(start = c(1973,4), end = 1998, frequency =4,deltat=1) for(i in 1:98){ j=i+11 rmsee_fr[i:i]=sqrt(mean(er2_fr[i:j]))} rmsee_fr rmsee_dm<-ts(start = c(1973,4), end = 1998, frequency =4,deltat=1) for(i in 1:98){ j=i+11 rmsee_dm[i:i]=sqrt(mean(er2_dm[i:j]))} rmsee_dm rmsee_nl<-ts(start = c(1980,4), end = 1998, frequency =4,deltat=1) for(i in 1:81){ j=i+11 rmsee_nl[i:i]=sqrt(mean(er2_nl[i:j]))} rmsee_nl rmsee_es<-ts(start = c(1973,4), end = 1998, frequency =4,deltat=1) for(i in 1:98){ j=i+11 rmsee_es[i:i]=sqrt(mean(er2_es[i:j]))} rmsee_es rmsee_it<-ts(start = c(1973,4), end = 1998, frequency =4,deltat=1) for(i in 1:98){ j=i+11 rmsee_it[i:i]=sqrt(mean(er2_it[i:j]))} rmsee_it rmsee_uk<-ts(start = c(1973,4), end = 1998, frequency =4,deltat=1) for(i in 1:98){ j=i+11 rmsee_uk[i:i]=sqrt(mean(er2_uk[i:j]))} rmsee_uk ts.plot(rmsee_fr,rmsee_dm,rmsee_it,rmsee_uk,rmsee_es,rmsee_nl, main="precision de la regle de taylor simulée cas 2", col=c) legend("topright",c("rmsee_fr","rmsee_dm","rmsee_it","rmsee_uk","rmsee_es","rmsee_nl"), col=c,lty = c(1,1,1,1,1,1)) #Problème n°2 : Evaluation par estimation et tests sur longue période reg1_fr=dynlm(ec_fr~ecinf_fr+gap_fr) summary(reg1_fr) te_fr<-tn_fr+fitted(reg1_fr)#taux court estimé te_fr reg1_dm=dynlm(ec_dm~ecinf_dm+gap_dm) summary(reg1_dm) te_dm<-tn_dm+fitted(reg1_dm)#taux court estimé te_dm reg1_nl=dynlm(ec_nl~ecinf_nl+gap_nl) summary(reg1_nl) te_nl<-tn_nl+fitted(reg1_nl)#taux court estimé te_nl reg1_es=dynlm(ec_es~ecinf_es+gap_es) summary(reg1_es) te_es<-tn_es+fitted(reg1_es)#taux court estimé te_es reg1_it=dynlm(ec_it~ecinf_it+gap_it) summary(reg1_it) te_it<-tn_it+fitted(reg1_it)#taux court estimé te_it reg1_uk=dynlm(ec_uk~ecinf_uk+gap_uk) summary(reg1_uk) te_uk<-tn_uk+fitted(reg1_uk) #taux court estimé te_uk #tests sur les paramètres lambda1 et lambda 2 linear.hypothesis(reg1_fr,"ecinf_fr=0.5") linear.hypothesis(reg1_fr,"gap_fr[5:113]=0.5") linear.hypothesis(reg1_fr,hypothesis.matrix=c(0,1,0),rhs=0.5)#alternativement linear.hypothesis(reg1_fr,hypothesis.matrix=c(0,0,1),rhs=0.5)#alternativement X1<-c(0,0,1,0,0,1) J<-matrix(data=X1,nrow=2,ncol=3) X2<-c(0.5,0.5) Q<-matrix(data=X2,nrow=2,ncol=1) linear.hypothesis(reg1_fr,hypothesis.matrix=J,rhs=Q) linear.hypothesis(reg1_dm,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1_dm,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1_dm,hypothesis.matrix=J,rhs=Q) linear.hypothesis(reg1_nl,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1_nl,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1_nl,hypothesis.matrix=J,rhs=Q) linear.hypothesis(reg1_es,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1_es,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1_es,hypothesis.matrix=J,rhs=Q) linear.hypothesis(reg1_it,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1_it,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1_it,hypothesis.matrix=J,rhs=Q) linear.hypothesis(reg1_uk,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1_uk,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1_uk,hypothesis.matrix=J,rhs=Q) # Problème n°3 analyse de la stabilité #question1 estimation par sous-periode #France reg1P1_fr=dynlm(ec_fr~ecinf_fr+gap_fr,start="",end=c(1979,4)) linear.hypothesis(reg1P1_fr,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P1_fr,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P1_fr,hypothesis.matrix=J,rhs=Q) summary(reg1P1_fr) reg1P2_fr=dynlm(ec_fr~ecinf_fr+gap_fr,start=c(1980,1),end=c(1989,4)) linear.hypothesis(reg1P2_fr,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P2_fr,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P2_fr,hypothesis.matrix=J,rhs=Q) summary(reg1P2_fr) reg1P3_fr=dynlm(ec_fr~ecinf_fr+gap_fr,start=c(1990,1)) linear.hypothesis(reg1P3_fr,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P3_fr,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P3_fr,hypothesis.matrix=J,rhs=Q) summary(reg1P3_fr) #Allemagne reg1P1_dm=dynlm(ec_dm~ecinf_dm+gap_dm,start="",end=c(1979,4)) linear.hypothesis(reg1P1_dm,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P1_dm,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P1_dm,hypothesis.matrix=J,rhs=Q) summary(reg1P1_dm) reg1P2_dm=dynlm(ec_dm~ecinf_dm+gap_dm,start=c(1980,1),end=c(1989,4)) linear.hypothesis(reg1P2_dm,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P2_dm,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P2_dm,hypothesis.matrix=J,rhs=Q) summary(reg1P2_dm) reg1P3_dm=dynlm(ec_dm~ecinf_dm+gap_dm,start=c(1990,1)) linear.hypothesis(reg1P3_dm,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P3_dm,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P3_dm,hypothesis.matrix=J,rhs=Q) summary(reg1P3_dm) #pays-Bas reg1P1_nl=dynlm(ec_nl~ecinf_nl+gap_nl,start="",end=c(1979,4)) linear.hypothesis(reg1P1_nl,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P1_nl,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P1_nl,hypothesis.matrix=J,rhs=Q) summary(reg1P1_nl) reg1P2_nl=dynlm(ec_nl~ecinf_nl+gap_nl,start=c(1980,1),end=c(1989,4)) linear.hypothesis(reg1P2_nl,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P2_nl,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P2_nl,hypothesis.matrix=J,rhs=Q) summary(reg1P2_nl) reg1P3_nl=dynlm(ec_nl~ecinf_nl+gap_nl,start=c(1990,1)) linear.hypothesis(reg1P3_nl,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P3_nl,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P3_nl,hypothesis.matrix=J,rhs=Q) summary(reg1P3_nl) #espagne reg1P1_es=dynlm(ec_es~ecinf_es+gap_es,start="",end=c(1979,4)) linear.hypothesis(reg1P1_es,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P1_es,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P1_es,hypothesis.matrix=J,rhs=Q) summary(reg1P1_es) reg1P2_es=dynlm(ec_es~ecinf_es+gap_es,start=c(1980,1),end=c(1989,4)) linear.hypothesis(reg1P2_es,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P2_es,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P2_es,hypothesis.matrix=J,rhs=Q) summary(reg1P2_es) reg1P3_es=dynlm(ec_es~ecinf_es+gap_es,start=c(1990,1)) linear.hypothesis(reg1P3_es,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P3_es,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P3_es,hypothesis.matrix=J,rhs=Q) summary(reg1P3_es) #italie reg1P1_it=dynlm(ec_it~ecinf_it+gap_it,start="",end=c(1979,4)) linear.hypothesis(reg1P1_it,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P1_it,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P1_it,hypothesis.matrix=J,rhs=Q) summary(reg1P1_it) reg1P2_it=dynlm(ec_it~ecinf_it+gap_it,start=c(1980,1),end=c(1989,4)) linear.hypothesis(reg1P2_it,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P2_it,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P2_it,hypothesis.matrix=J,rhs=Q) summary(reg1P2_it) reg1P3_it=dynlm(ec_it~ecinf_it+gap_it,start=c(1990,1)) linear.hypothesis(reg1P3_it,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P3_it,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P3_it,hypothesis.matrix=J,rhs=Q) summary(reg1P3_it) #royaume-uni reg1P1_uk=dynlm(ec_uk~ecinf_uk+gap_uk,start="",end=c(1979,4)) linear.hypothesis(reg1P1_uk,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P1_uk,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P1_uk,hypothesis.matrix=J,rhs=Q) summary(reg1P1_uk) reg1P2_uk=dynlm(ec_uk~ecinf_uk+gap_uk,start=c(1980,1),end=c(1989,4)) linear.hypothesis(reg1P2_uk,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P2_uk,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P2_uk,hypothesis.matrix=J,rhs=Q) summary(reg1P2_uk) reg1P3_uk=dynlm(ec_uk~ecinf_uk+gap_uk,start=c(1990,1)) linear.hypothesis(reg1P3_uk,hypothesis.matrix=c(0,1,0),rhs=0.5) linear.hypothesis(reg1P3_uk,hypothesis.matrix=c(0,0,1),rhs=0.5) linear.hypothesis(reg1P3_uk,hypothesis.matrix=J,rhs=Q) summary(reg1P3_uk) #question 2 test du cusum wr_fr<-efp(ec_fr~ecinf_fr+gap_fr[5:113],type="Rec-CUSUM") plot(wr_fr) wr_dm<-efp(ec_dm~ecinf_dm+gap_dm[5:113],type="Rec-CUSUM") plot(wr_dm) wr_nl<-efp(ec_nl~ecinf_nl[29:109]+gap_nl[5:85],type="Rec-CUSUM") plot(wr_nl) wr_es<-efp(ec_es[10:109]~ecinf_es[10:109]+gap_es[14:113],type="Rec-CUSUM") plot(wr_es) wr_it<-efp(ec_it~ecinf_it+gap_it[5:113],type="Rec-CUSUM") plot(wr_it) wr_uk<-efp(ec_uk~ecinf_uk+gap_uk[5:113],type="Rec-CUSUM") plot(wr_uk) # question 3 regressions glissantes #france lambda1<-vector(length=75) min1<-vector(length=75) sup1<-vector(length=75) lambda2<-vector(length=75) min2<-vector(length=75) sup2<-vector(length=75) for(i in 1:75){ reg2=dynlm(ec_fr~ecinf_fr+gap_fr,start=c(1970,2+i),end=c(1979,4+i)) lambda1[i]=reg2$coef[2] min1[i]=lambda1[i]+2*sqrt(vcov(reg2)[2,2]) sup1[i]=lambda1[i]-2*sqrt(vcov(reg2)[2,2]) lambda2[i]=reg2$coef[3] min2[i]=lambda2[i]+2*sqrt(vcov(reg2)[3,3]) sup2[i]=lambda2[i]-2*sqrt(vcov(reg2)[3,3])} plot(lambda1,ylim=c(-2,2.5)) lines(min1,col="red") lines(sup1,col="blue") plot(lambda2,ylim=c(-2,2.5)) lines(min2,col="red") lines(sup2,col="blue") #Allemagne for(i in 1:75){ reg2=dynlm(ec_dm~ecinf_dm+gap_dm,start=c(1970,2+i),end=c(1979,4+i)) lambda1[i]=reg2$coef[2] min1[i]=lambda1[i]+2*sqrt(vcov(reg2)[2,2]) sup1[i]=lambda1[i]-2*sqrt(vcov(reg2)[2,2]) lambda2[i]=reg2$coef[3] min2[i]=lambda2[i]+2*sqrt(vcov(reg2)[3,3]) sup2[i]=lambda2[i]-2*sqrt(vcov(reg2)[3,3])} plot(lambda1,ylim=c(-0.75,1.25)) lines(min1,col="red") lines(sup1,col="blue") plot(lambda2,ylim=c(-0.5,1.25)) lines(min2,col="red") lines(sup2,col="blue") plot(lambda1) lines(min1,col="red") lines(sup1,col="blue") min1 sup1 plot(lambda2) lines(min2,col="red") lines(sup2,col="blue") #pays-bas for(i in 1:75){ reg2=dynlm(ec_nl~ecinf_nl+gap_nl,start=c(1970,2+i),end=c(1979,4+i)) lambda1[i]=reg2$coef[2] min1[i]=lambda1[i]+2*sqrt(vcov(reg2)[2,2]) sup1[i]=lambda1[i]-2*sqrt(vcov(reg2)[2,2]) lambda2[i]=reg2$coef[3] min2[i]=lambda2[i]+2*sqrt(vcov(reg2)[3,3]) sup2[i]=lambda2[i]-2*sqrt(vcov(reg2)[3,3])} plot(lambda1) lines(min1,col="red") lines(sup1,col="blue") plot(lambda2) lines(min2,col="red") lines(sup2,col="blue") #espagne for(i in 1:75){ reg2=dynlm(ec_es~ecinf_es+gap_es,start=c(1970,2+i),end=c(1979,4+i)) lambda1[i]=reg2$coef[2] min1[i]=lambda1[i]+2*sqrt(vcov(reg2)[2,2]) sup1[i]=lambda1[i]-2*sqrt(vcov(reg2)[2,2]) lambda2[i]=reg2$coef[3] min2[i]=lambda2[i]+2*sqrt(vcov(reg2)[3,3]) sup2[i]=lambda2[i]-2*sqrt(vcov(reg2)[3,3])} plot(lambda1) lines(min1,col="red") lines(sup1,col="blue") plot(lambda2) lines(min2,col="red") lines(sup2,col="blue") #italie for(i in 1:75){ reg2=dynlm(ec_it~ecinf_it+gap_it,start=c(1970,2+i),end=c(1979,4+i)) lambda1[i]=reg2$coef[2] min1[i]=lambda1[i]+2*sqrt(vcov(reg2)[2,2]) sup1[i]=lambda1[i]-2*sqrt(vcov(reg2)[2,2]) lambda2[i]=reg2$coef[3] min2[i]=lambda2[i]+2*sqrt(vcov(reg2)[3,3]) sup2[i]=lambda2[i]-2*sqrt(vcov(reg2)[3,3])} plot(lambda1) lines(min1,col="red") lines(sup1,col="blue") plot(lambda2) lines(min2,col="red") lines(sup2,col="blue") #royaume-uni for(i in 1:75){ reg2=dynlm(ec_uk~ecinf_uk+gap_uk,start=c(1970,2+i),end=c(1979,4+i)) lambda1[i]=reg2$coef[2] min1[i]=lambda1[i]+2*sqrt(vcov(reg2)[2,2]) sup1[i]=lambda1[i]-2*sqrt(vcov(reg2)[2,2]) lambda2[i]=reg2$coef[3] min2[i]=lambda2[i]+2*sqrt(vcov(reg2)[3,3]) sup2[i]=lambda2[i]-2*sqrt(vcov(reg2)[3,3])} plot(lambda1) lines(min1,col="red") lines(sup1,col="blue") plot(lambda2) lines(min2,col="red") lines(sup2,col="blue")