SlideShare a Scribd company logo
1 of 18
Chapter 2. Multivariate Analysis of
     Stationary Time Series




          Cheng-Jun Wang
Contents
w
                     No
          2000s




                     C   M
                  VE
          1990s
History



                         e   r     &
                       ng
                  Gr a        tion
                           gra tion
                      Inte tegra
                           in
                        Co
          1987
                    Sim        R
                             VA
          1980
VAR
Matrix Multiplication




http://en.wikipedia.org/wiki/Matrix_multiplication
Matrix Addition
R Code 2.1
                Simulation of Var (2)-process

## Simulate VAR(2)-data                                 ## Obtaining the generated series
library(dse1)                                           vardat <- matrix(varsim$output, nrow = 500, ncol = 2)
library(vars)
                                                        colnames(vardat) <- c("y1", "y2")
## Setting the lag-polynomial A(L)
Apoly <- array(c(1.0, -0.5, 0.3, 0,                     ## Plotting the series
          0.2, 0.1, 0, -0.2,                            plot.ts(vardat, main = "", xlab = "")
          0.7, 1, 0.5, -0.3) ,                          ## Determining an appropriate lag-order
         c(3, 2, 2))                                    infocrit <- VARselect(vardat, lag.max = 3,
## Setting Covariance to identity-matrix                             type = "const")
B <- diag(2)
## Setting constant term to 5 and 10
                                                        ## Estimating the model
TRD <- c(5, 10)                                         varsimest <- VAR(vardat, p = 2, type = "const",
## Generating the VAR(2) model                                    season = NULL, exogen = NULL)
var2 <- ARMA(A = Apoly, B = B, TREND = TRD)             ## Alternatively, selection according to AIC
## Simulating 500 observations                          varsimest <- VAR(vardat, type = "const",
varsim <- simulate(var2, sampleT = 500,
                                                                  lag.max = 3, ic = "SC")
          noise = list(w = matrix(rnorm(1000),
nrow = 500, ncol = 2)), rng = list(seed = c(123456)))   ## Checking the roots
                                                        roots <- roots(varsimest)
R Code 2.2
     Diagnostic tests of VAR(2)-process

∗   ## testing serial correlation                          ∗   ## class and methods for diganostic tests
∗   args(serial.test)
∗   ## Portmanteau-Test                                    ∗   class(var2c.serial)
∗   var2c.serial <- serial.test(varsimest, lags.pt = 16,   ∗   class(var2c.arch)
∗                   type = "PT.asymptotic")
∗   var2c.serial                                           ∗   class(var2c.norm)
∗   plot(var2c.serial, names = "y1")                       ∗   methods(class = "varcheck")
∗   plot(var2c.serial, names = "y2")
∗   ## testing heteroscedasticity
                                                           ∗   ## Plot of objects "varcheck"
∗   args(arch.test)                                        ∗   args(vars:::plot.varcheck)
∗
∗
    var2c.arch <- arch.test(varsimest, lags.multi = 5,     ∗   plot(var2c.serial, names = "y1")
                 multivariate.only = TRUE)
∗   var2c.arch                                             ∗   ## Structural stability test
∗   ## testing for normality                               ∗   reccusum <- stability(varsimest,
∗   args(normality.test)
∗   var2c.norm <- normality.test(varsimest,                ∗      type = "OLS-CUSUM")
∗                    multivariate.only = TRUE)             ∗   fluctuation <- stability(varsimest,
∗   var2c.norm
                                                           ∗      type = "fluctuation")
Causality Analysis

∗ Granger causality
∗ Wald-type instantaneous causality
∗ ## Causality tests
∗ ## Granger and instantaneous causality
∗ var.causal <- causality(varsimest, cause = "y2")
Forecasting


       ∗ ## Forecasting objects of class varest
       ∗ args(vars:::predict.varest)
       ∗ predictions <- predict(varsimest, n.ahead
         = 25,
       ∗              ci = 0.95)
       ∗ class(predictions)
       ∗ args(vars:::plot.varprd)
       ∗ ## Plot of predictions for y1
       ∗ plot(predictions, names = "y1")
       ∗ ## Fanchart for y2
       ∗ args(fanchart)
       ∗ fanchart(predictions, names = "y2")
Impulse Response Function

∗ Causality test falls short of quantifying the impact of the
  impulse variable on the response variable over time.
∗ The impulse response analysis is used to investigate these kinds
  of dynamic interactions between the endogenous variables and
  is based upon the Wold moving average representation of a
  VAR(p)-process.
## Forecast error variance
## Impulse response analysis                           decomposition

∗ irf.y1 <- irf(varsimest, impulse = "y1",    ∗ fevd.var2 <- fevd(varsimest,
∗          response = "y2", n.ahead = 10,
∗          ortho = FALSE, cumulative =          n.ahead = 10)
  FALSE,                                      ∗ args(vars:::plot.varfevd)
∗          boot = FALSE, seed = 12345)
∗ args(vars:::plot.varirf)                    ∗ plot(fevd.var2, addbars = 2)
∗ plot(irf.y1)
∗ irf.y2 <- irf(varsimest, impulse = "y2",
∗          response = "y1", n.ahead = 10,
∗          ortho = TRUE, cumulative = TRUE,
∗          boot = FALSE, seed = 12345)
∗ plot(irf.y2)
SVAR

∗ An SVAR-model can be used to identify shocks and trace these
  out by employing IRA and/or FEVD through imposing
  restrictions on the matrices A and/or B.
SVAR: A-model


∗   library(dse1)                               ∗   ## Obtaining the generated series
∗   library(vars)                               ∗   svardat <- matrix(svarsim$output, nrow = 500, ncol =
∗   ## A-model                                      2)
                                                ∗   colnames(svardat) <- c("y1", "y2")
∗   Apoly <- array(c(1.0, -0.5, 0.3, 0.8,
                                                ∗   ## Estimating the VAR
∗             0.2, 0.1, -0.7, -0.2,             ∗   varest <- VAR(svardat, p = 2, type = "none")
∗             0.7, 1, 0.5, -0.3) ,              ∗   ## Setting up matrices for A-model
∗            c(3, 2, 2))                        ∗   Amat <- diag(2)
∗   ## Setting covariance to identity-matrix    ∗   Amat[2, 1] <- NA
∗   B <- diag(2)                                ∗   Amat[1, 2] <- NA
∗   ## Generating the VAR(2) model              ∗   ## Estimating the SVAR A-type by direct
∗   svarA <- ARMA(A = Apoly, B = B)                 maximisation
∗   ## Simulating 500 observations              ∗   ## of the log-likelihood
∗   svarsim <- simulate(svarA, sampleT = 500,   ∗   args(SVAR)
                                                ∗   svar.A <- SVAR(varest, estmethod = "direct",
∗              rng = list(seed = c(123456)))
                                                ∗           Amat = Amat, hessian = TRUE)
SVAR: B-model


∗   library(dse1)                              ∗   ## Simulating 500 observations
∗   library(vars)                              ∗   svarsim <- simulate(svarB, sampleT = 500,
∗   ## B-model                                 ∗              rng = list(seed = c(123456)))
                                               ∗   svardat <- matrix(svarsim$output, nrow = 500,
∗   Apoly <- array(c(1.0, -0.5, 0.3, 0,            ncol = 2)
∗               0.2, 0.1, 0, -0.2,             ∗   colnames(svardat) <- c("y1", "y2")
∗               0.7, 1, 0.5, -0.3) ,           ∗   varest <- VAR(svardat, p = 2, type = "none")
∗              c(3, 2, 2))                     ∗   ## Estimating the SVAR B-type by scoring
                                                   algorithm
∗   ## Setting covariance to identity-matrix   ∗   ## Setting up the restriction matrix and vector
∗   B <- diag(2)                               ∗   ## for B-model
∗   B[2, 1] <- -0.8                            ∗   Bmat <- diag(2)
∗   ## Generating the VAR(2) model             ∗   Bmat[2, 1] <- NA
∗   svarB <- ARMA(A = Apoly, B = B)            ∗   svar.B <- SVAR(varest, estmethod = "scoring",
                                               ∗           Bmat = Bmat, max.iter = 200)
## Impulse response analysis of        ## FEVD analysis of SVAR B-type
     SVAR A-type model                             model

∗ args(vars:::irf.svarest)             ∗ args(vars:::fevd.svarest)
∗ irf.svara <- irf(svar.A, impulse =   ∗ fevd.svarb <- fevd(svar.B, n.ahead
  "y1", response = "y2", boot =          = 5)
  FALSE)                               ∗ class(fevd.svarb)
∗ args(vars:::plot.varirf)             ∗ methods(class = "varfevd")
∗ plot(irf.svara)                      ∗ plot(fevd.svarb)
20121209

More Related Content

What's hot

深入浅出Jscex
深入浅出Jscex深入浅出Jscex
深入浅出Jscexjeffz
 
Random stability in systemVerilog and UVM based testbench
Random stability in systemVerilog and UVM based testbenchRandom stability in systemVerilog and UVM based testbench
Random stability in systemVerilog and UVM based testbenchKashyap Adodariya
 
Pro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptPro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptSeok-joon Yun
 
Welcome to Modern C++
Welcome to Modern C++Welcome to Modern C++
Welcome to Modern C++Seok-joon Yun
 
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good codeGiordano Scalzo
 
Swift 3 Programming for iOS : subscript init
Swift 3 Programming for iOS : subscript initSwift 3 Programming for iOS : subscript init
Swift 3 Programming for iOS : subscript initKwang Woo NAM
 
The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196Mahmoud Samir Fayed
 
Dynamic Mesh in OpenFOAM
Dynamic Mesh in OpenFOAMDynamic Mesh in OpenFOAM
Dynamic Mesh in OpenFOAMFumiya Nozaki
 
Futures e abstração - QCon São Paulo 2015
Futures e abstração - QCon São Paulo 2015Futures e abstração - QCon São Paulo 2015
Futures e abstração - QCon São Paulo 2015Leonardo Borges
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisaujihisa
 

What's hot (17)

深入浅出Jscex
深入浅出Jscex深入浅出Jscex
深入浅出Jscex
 
Random stability in systemVerilog and UVM based testbench
Random stability in systemVerilog and UVM based testbenchRandom stability in systemVerilog and UVM based testbench
Random stability in systemVerilog and UVM based testbench
 
CoffeeScript
CoffeeScriptCoffeeScript
CoffeeScript
 
Pro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScriptPro typescript.ch03.Object Orientation in TypeScript
Pro typescript.ch03.Object Orientation in TypeScript
 
sas aeroplan sample
sas aeroplan samplesas aeroplan sample
sas aeroplan sample
 
Welcome to Modern C++
Welcome to Modern C++Welcome to Modern C++
Welcome to Modern C++
 
Jamming attack in wireless network
Jamming attack in wireless networkJamming attack in wireless network
Jamming attack in wireless network
 
V8
V8V8
V8
 
Live Updating Swift Code
Live Updating Swift CodeLive Updating Swift Code
Live Updating Swift Code
 
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good code
 
Swift 3 Programming for iOS : subscript init
Swift 3 Programming for iOS : subscript initSwift 3 Programming for iOS : subscript init
Swift 3 Programming for iOS : subscript init
 
Breaking the wall
Breaking the wallBreaking the wall
Breaking the wall
 
1.2 scala basics
1.2 scala basics1.2 scala basics
1.2 scala basics
 
The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196The Ring programming language version 1.7 book - Part 83 of 196
The Ring programming language version 1.7 book - Part 83 of 196
 
Dynamic Mesh in OpenFOAM
Dynamic Mesh in OpenFOAMDynamic Mesh in OpenFOAM
Dynamic Mesh in OpenFOAM
 
Futures e abstração - QCon São Paulo 2015
Futures e abstração - QCon São Paulo 2015Futures e abstração - QCon São Paulo 2015
Futures e abstração - QCon São Paulo 2015
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisa
 

Viewers also liked

Oil Prices Modelling
Oil Prices ModellingOil Prices Modelling
Oil Prices ModellingHanan Naser
 
E views 6 users guide i
E views 6 users guide iE views 6 users guide i
E views 6 users guide iAdi Irawan
 
E views 7 student version
E views 7 student versionE views 7 student version
E views 7 student versionHyun Bin Kim
 
Estimation de l'ecart de production et inflation dans la CEMAC
Estimation de l'ecart de production et inflation dans la CEMACEstimation de l'ecart de production et inflation dans la CEMAC
Estimation de l'ecart de production et inflation dans la CEMACUniversité de Dschang
 
Use of R in Actuarial Works
Use of R in Actuarial WorksUse of R in Actuarial Works
Use of R in Actuarial Works基晴 出井
 
Using R for Analyzing Loans, Portfolios and Risk: From Academic Theory to Fi...
Using R for Analyzing Loans, Portfolios and Risk:  From Academic Theory to Fi...Using R for Analyzing Loans, Portfolios and Risk:  From Academic Theory to Fi...
Using R for Analyzing Loans, Portfolios and Risk: From Academic Theory to Fi...Revolution Analytics
 
Déterminants de l'inflation dans la CEMAC: le rôle de la monnaie
Déterminants de l'inflation dans la CEMAC: le rôle de la monnaieDéterminants de l'inflation dans la CEMAC: le rôle de la monnaie
Déterminants de l'inflation dans la CEMAC: le rôle de la monnaieUniversité de Dschang
 
Spillover Dynamics for Systemic Risk Measurement Using Spatial Financial Time...
Spillover Dynamics for Systemic Risk Measurement Using Spatial Financial Time...Spillover Dynamics for Systemic Risk Measurement Using Spatial Financial Time...
Spillover Dynamics for Systemic Risk Measurement Using Spatial Financial Time...SYRTO Project
 
On clustering financial time series - A need for distances between dependent ...
On clustering financial time series - A need for distances between dependent ...On clustering financial time series - A need for distances between dependent ...
On clustering financial time series - A need for distances between dependent ...Gautier Marti
 
R in finance: Introduction to R and Its Applications in Finance
R in finance: Introduction to R and Its Applications in FinanceR in finance: Introduction to R and Its Applications in Finance
R in finance: Introduction to R and Its Applications in FinanceLiang C. Zhang (張良丞)
 
Econometrics theory and_applications_with_eviews
Econometrics theory and_applications_with_eviewsEconometrics theory and_applications_with_eviews
Econometrics theory and_applications_with_eviewsDeiven Jesus Palpa
 

Viewers also liked (15)

isi
isiisi
isi
 
Oil Prices Modelling
Oil Prices ModellingOil Prices Modelling
Oil Prices Modelling
 
E views 6 users guide i
E views 6 users guide iE views 6 users guide i
E views 6 users guide i
 
E views 7 student version
E views 7 student versionE views 7 student version
E views 7 student version
 
Serial correlation
Serial correlationSerial correlation
Serial correlation
 
Cours econométrie des séries temporelles (1)
Cours econométrie des séries temporelles (1)Cours econométrie des séries temporelles (1)
Cours econométrie des séries temporelles (1)
 
Heteroskedasticity
HeteroskedasticityHeteroskedasticity
Heteroskedasticity
 
Estimation de l'ecart de production et inflation dans la CEMAC
Estimation de l'ecart de production et inflation dans la CEMACEstimation de l'ecart de production et inflation dans la CEMAC
Estimation de l'ecart de production et inflation dans la CEMAC
 
Use of R in Actuarial Works
Use of R in Actuarial WorksUse of R in Actuarial Works
Use of R in Actuarial Works
 
Using R for Analyzing Loans, Portfolios and Risk: From Academic Theory to Fi...
Using R for Analyzing Loans, Portfolios and Risk:  From Academic Theory to Fi...Using R for Analyzing Loans, Portfolios and Risk:  From Academic Theory to Fi...
Using R for Analyzing Loans, Portfolios and Risk: From Academic Theory to Fi...
 
Déterminants de l'inflation dans la CEMAC: le rôle de la monnaie
Déterminants de l'inflation dans la CEMAC: le rôle de la monnaieDéterminants de l'inflation dans la CEMAC: le rôle de la monnaie
Déterminants de l'inflation dans la CEMAC: le rôle de la monnaie
 
Spillover Dynamics for Systemic Risk Measurement Using Spatial Financial Time...
Spillover Dynamics for Systemic Risk Measurement Using Spatial Financial Time...Spillover Dynamics for Systemic Risk Measurement Using Spatial Financial Time...
Spillover Dynamics for Systemic Risk Measurement Using Spatial Financial Time...
 
On clustering financial time series - A need for distances between dependent ...
On clustering financial time series - A need for distances between dependent ...On clustering financial time series - A need for distances between dependent ...
On clustering financial time series - A need for distances between dependent ...
 
R in finance: Introduction to R and Its Applications in Finance
R in finance: Introduction to R and Its Applications in FinanceR in finance: Introduction to R and Its Applications in Finance
R in finance: Introduction to R and Its Applications in Finance
 
Econometrics theory and_applications_with_eviews
Econometrics theory and_applications_with_eviewsEconometrics theory and_applications_with_eviews
Econometrics theory and_applications_with_eviews
 

Similar to Chapter 2. Multivariate Analysis of Stationary Time Series

Introduction aux Macros
Introduction aux MacrosIntroduction aux Macros
Introduction aux Macrosunivalence
 
Scala introduction
Scala introductionScala introduction
Scala introductionvito jeng
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptCaridy Patino
 
Error Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportError Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportMuragesh Kabbinakantimath
 
Beauty and the beast - Haskell on JVM
Beauty and the beast  - Haskell on JVMBeauty and the beast  - Haskell on JVM
Beauty and the beast - Haskell on JVMJarek Ratajski
 
Groovy collection api
Groovy collection apiGroovy collection api
Groovy collection apitrygvea
 
Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...
Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...
Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...ShuaiGao3
 
1.5.recommending music with apache spark ml
1.5.recommending music with apache spark ml1.5.recommending music with apache spark ml
1.5.recommending music with apache spark mlleorick lin
 
Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Phil Calçado
 
How to use SVM for data classification
How to use SVM for data classificationHow to use SVM for data classification
How to use SVM for data classificationYiwei Chen
 
Ridge-based Profiled Differential Power Analysis
Ridge-based Profiled Differential Power AnalysisRidge-based Profiled Differential Power Analysis
Ridge-based Profiled Differential Power AnalysisPriyanka Aash
 
Meta-objective Lisp @名古屋 Reject 会議
Meta-objective Lisp @名古屋 Reject 会議Meta-objective Lisp @名古屋 Reject 会議
Meta-objective Lisp @名古屋 Reject 会議dico_leque
 
Write a Matlab code (a computerized program) for calculating plane st.docx
 Write a Matlab code (a computerized program) for calculating plane st.docx Write a Matlab code (a computerized program) for calculating plane st.docx
Write a Matlab code (a computerized program) for calculating plane st.docxajoy21
 
Datamining R 4th
Datamining R 4thDatamining R 4th
Datamining R 4thsesejun
 

Similar to Chapter 2. Multivariate Analysis of Stationary Time Series (20)

Ns2programs
Ns2programsNs2programs
Ns2programs
 
2.3 implicits
2.3 implicits2.3 implicits
2.3 implicits
 
Introduction aux Macros
Introduction aux MacrosIntroduction aux Macros
Introduction aux Macros
 
Scala introduction
Scala introductionScala introduction
Scala introduction
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScript
 
Error Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportError Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks report
 
Beauty and the beast - Haskell on JVM
Beauty and the beast  - Haskell on JVMBeauty and the beast  - Haskell on JVM
Beauty and the beast - Haskell on JVM
 
Groovy collection api
Groovy collection apiGroovy collection api
Groovy collection api
 
Eta
EtaEta
Eta
 
Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...
Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...
Time Series Analysis on Egg depositions (in millions) of age-3 Lake Huron Blo...
 
numdoc
numdocnumdoc
numdoc
 
Hello scala
Hello scalaHello scala
Hello scala
 
tutorial5
tutorial5tutorial5
tutorial5
 
1.5.recommending music with apache spark ml
1.5.recommending music with apache spark ml1.5.recommending music with apache spark ml
1.5.recommending music with apache spark ml
 
Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)
 
How to use SVM for data classification
How to use SVM for data classificationHow to use SVM for data classification
How to use SVM for data classification
 
Ridge-based Profiled Differential Power Analysis
Ridge-based Profiled Differential Power AnalysisRidge-based Profiled Differential Power Analysis
Ridge-based Profiled Differential Power Analysis
 
Meta-objective Lisp @名古屋 Reject 会議
Meta-objective Lisp @名古屋 Reject 会議Meta-objective Lisp @名古屋 Reject 会議
Meta-objective Lisp @名古屋 Reject 会議
 
Write a Matlab code (a computerized program) for calculating plane st.docx
 Write a Matlab code (a computerized program) for calculating plane st.docx Write a Matlab code (a computerized program) for calculating plane st.docx
Write a Matlab code (a computerized program) for calculating plane st.docx
 
Datamining R 4th
Datamining R 4thDatamining R 4th
Datamining R 4th
 

More from Chengjun Wang

计算传播学导论
计算传播学导论计算传播学导论
计算传播学导论Chengjun Wang
 
数据可视化 概念案例方法 王成军 20140104
数据可视化 概念案例方法 王成军 20140104数据可视化 概念案例方法 王成军 20140104
数据可视化 概念案例方法 王成军 20140104Chengjun Wang
 
Randomly sampling YouTube users
Randomly sampling YouTube usersRandomly sampling YouTube users
Randomly sampling YouTube usersChengjun Wang
 
An introduction to computational communication
An introduction to computational communication An introduction to computational communication
An introduction to computational communication Chengjun Wang
 
Pajek chapter2 Attributes and Relations
Pajek chapter2 Attributes and RelationsPajek chapter2 Attributes and Relations
Pajek chapter2 Attributes and RelationsChengjun Wang
 
Calculate Thresholds of Diffusion with Pajek
Calculate Thresholds of Diffusion with PajekCalculate Thresholds of Diffusion with Pajek
Calculate Thresholds of Diffusion with PajekChengjun Wang
 
人类行为与最大熵原理
人类行为与最大熵原理人类行为与最大熵原理
人类行为与最大熵原理Chengjun Wang
 
Impact of human value, consumer perceived value
Impact of human value, consumer perceived valueImpact of human value, consumer perceived value
Impact of human value, consumer perceived valueChengjun Wang
 
Introduction to News diffusion On News Sharing Website
Introduction to News diffusion On News Sharing WebsiteIntroduction to News diffusion On News Sharing Website
Introduction to News diffusion On News Sharing WebsiteChengjun Wang
 
The Emergence of Spiral of Silence from Individual behaviors: Agent-based Mod...
The Emergence of Spiral of Silence from Individual behaviors: Agent-based Mod...The Emergence of Spiral of Silence from Individual behaviors: Agent-based Mod...
The Emergence of Spiral of Silence from Individual behaviors: Agent-based Mod...Chengjun Wang
 
Suppressor and distort variables
Suppressor and distort variablesSuppressor and distort variables
Suppressor and distort variablesChengjun Wang
 
Stata Learning From Treiman
Stata Learning From TreimanStata Learning From Treiman
Stata Learning From TreimanChengjun Wang
 
A M O S L E A R N I N G
A M O S  L E A R N I N GA M O S  L E A R N I N G
A M O S L E A R N I N GChengjun Wang
 

More from Chengjun Wang (15)

计算传播学导论
计算传播学导论计算传播学导论
计算传播学导论
 
数据可视化 概念案例方法 王成军 20140104
数据可视化 概念案例方法 王成军 20140104数据可视化 概念案例方法 王成军 20140104
数据可视化 概念案例方法 王成军 20140104
 
Randomly sampling YouTube users
Randomly sampling YouTube usersRandomly sampling YouTube users
Randomly sampling YouTube users
 
An introduction to computational communication
An introduction to computational communication An introduction to computational communication
An introduction to computational communication
 
Pajek chapter2 Attributes and Relations
Pajek chapter2 Attributes and RelationsPajek chapter2 Attributes and Relations
Pajek chapter2 Attributes and Relations
 
Calculate Thresholds of Diffusion with Pajek
Calculate Thresholds of Diffusion with PajekCalculate Thresholds of Diffusion with Pajek
Calculate Thresholds of Diffusion with Pajek
 
人类行为与最大熵原理
人类行为与最大熵原理人类行为与最大熵原理
人类行为与最大熵原理
 
Impact of human value, consumer perceived value
Impact of human value, consumer perceived valueImpact of human value, consumer perceived value
Impact of human value, consumer perceived value
 
Introduction to News diffusion On News Sharing Website
Introduction to News diffusion On News Sharing WebsiteIntroduction to News diffusion On News Sharing Website
Introduction to News diffusion On News Sharing Website
 
The Emergence of Spiral of Silence from Individual behaviors: Agent-based Mod...
The Emergence of Spiral of Silence from Individual behaviors: Agent-based Mod...The Emergence of Spiral of Silence from Individual behaviors: Agent-based Mod...
The Emergence of Spiral of Silence from Individual behaviors: Agent-based Mod...
 
Suppressor and distort variables
Suppressor and distort variablesSuppressor and distort variables
Suppressor and distort variables
 
Pajek chapter1
Pajek chapter1Pajek chapter1
Pajek chapter1
 
Stata Learning From Treiman
Stata Learning From TreimanStata Learning From Treiman
Stata Learning From Treiman
 
A M O S L E A R N I N G
A M O S  L E A R N I N GA M O S  L E A R N I N G
A M O S L E A R N I N G
 
Amos Learning
Amos LearningAmos Learning
Amos Learning
 

Recently uploaded

Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 

Recently uploaded (20)

Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 

Chapter 2. Multivariate Analysis of Stationary Time Series

  • 1. Chapter 2. Multivariate Analysis of Stationary Time Series Cheng-Jun Wang
  • 3. w No 2000s C M VE 1990s History e r & ng Gr a tion gra tion Inte tegra in Co 1987 Sim R VA 1980
  • 4. VAR
  • 7. R Code 2.1 Simulation of Var (2)-process ## Simulate VAR(2)-data ## Obtaining the generated series library(dse1) vardat <- matrix(varsim$output, nrow = 500, ncol = 2) library(vars) colnames(vardat) <- c("y1", "y2") ## Setting the lag-polynomial A(L) Apoly <- array(c(1.0, -0.5, 0.3, 0, ## Plotting the series 0.2, 0.1, 0, -0.2, plot.ts(vardat, main = "", xlab = "") 0.7, 1, 0.5, -0.3) , ## Determining an appropriate lag-order c(3, 2, 2)) infocrit <- VARselect(vardat, lag.max = 3, ## Setting Covariance to identity-matrix type = "const") B <- diag(2) ## Setting constant term to 5 and 10 ## Estimating the model TRD <- c(5, 10) varsimest <- VAR(vardat, p = 2, type = "const", ## Generating the VAR(2) model season = NULL, exogen = NULL) var2 <- ARMA(A = Apoly, B = B, TREND = TRD) ## Alternatively, selection according to AIC ## Simulating 500 observations varsimest <- VAR(vardat, type = "const", varsim <- simulate(var2, sampleT = 500, lag.max = 3, ic = "SC") noise = list(w = matrix(rnorm(1000), nrow = 500, ncol = 2)), rng = list(seed = c(123456))) ## Checking the roots roots <- roots(varsimest)
  • 8. R Code 2.2 Diagnostic tests of VAR(2)-process ∗ ## testing serial correlation ∗ ## class and methods for diganostic tests ∗ args(serial.test) ∗ ## Portmanteau-Test ∗ class(var2c.serial) ∗ var2c.serial <- serial.test(varsimest, lags.pt = 16, ∗ class(var2c.arch) ∗ type = "PT.asymptotic") ∗ var2c.serial ∗ class(var2c.norm) ∗ plot(var2c.serial, names = "y1") ∗ methods(class = "varcheck") ∗ plot(var2c.serial, names = "y2") ∗ ## testing heteroscedasticity ∗ ## Plot of objects "varcheck" ∗ args(arch.test) ∗ args(vars:::plot.varcheck) ∗ ∗ var2c.arch <- arch.test(varsimest, lags.multi = 5, ∗ plot(var2c.serial, names = "y1") multivariate.only = TRUE) ∗ var2c.arch ∗ ## Structural stability test ∗ ## testing for normality ∗ reccusum <- stability(varsimest, ∗ args(normality.test) ∗ var2c.norm <- normality.test(varsimest, ∗ type = "OLS-CUSUM") ∗ multivariate.only = TRUE) ∗ fluctuation <- stability(varsimest, ∗ var2c.norm ∗ type = "fluctuation")
  • 9. Causality Analysis ∗ Granger causality ∗ Wald-type instantaneous causality
  • 10. ∗ ## Causality tests ∗ ## Granger and instantaneous causality ∗ var.causal <- causality(varsimest, cause = "y2")
  • 11. Forecasting ∗ ## Forecasting objects of class varest ∗ args(vars:::predict.varest) ∗ predictions <- predict(varsimest, n.ahead = 25, ∗ ci = 0.95) ∗ class(predictions) ∗ args(vars:::plot.varprd) ∗ ## Plot of predictions for y1 ∗ plot(predictions, names = "y1") ∗ ## Fanchart for y2 ∗ args(fanchart) ∗ fanchart(predictions, names = "y2")
  • 12. Impulse Response Function ∗ Causality test falls short of quantifying the impact of the impulse variable on the response variable over time. ∗ The impulse response analysis is used to investigate these kinds of dynamic interactions between the endogenous variables and is based upon the Wold moving average representation of a VAR(p)-process.
  • 13. ## Forecast error variance ## Impulse response analysis decomposition ∗ irf.y1 <- irf(varsimest, impulse = "y1", ∗ fevd.var2 <- fevd(varsimest, ∗ response = "y2", n.ahead = 10, ∗ ortho = FALSE, cumulative = n.ahead = 10) FALSE, ∗ args(vars:::plot.varfevd) ∗ boot = FALSE, seed = 12345) ∗ args(vars:::plot.varirf) ∗ plot(fevd.var2, addbars = 2) ∗ plot(irf.y1) ∗ irf.y2 <- irf(varsimest, impulse = "y2", ∗ response = "y1", n.ahead = 10, ∗ ortho = TRUE, cumulative = TRUE, ∗ boot = FALSE, seed = 12345) ∗ plot(irf.y2)
  • 14. SVAR ∗ An SVAR-model can be used to identify shocks and trace these out by employing IRA and/or FEVD through imposing restrictions on the matrices A and/or B.
  • 15. SVAR: A-model ∗ library(dse1) ∗ ## Obtaining the generated series ∗ library(vars) ∗ svardat <- matrix(svarsim$output, nrow = 500, ncol = ∗ ## A-model 2) ∗ colnames(svardat) <- c("y1", "y2") ∗ Apoly <- array(c(1.0, -0.5, 0.3, 0.8, ∗ ## Estimating the VAR ∗ 0.2, 0.1, -0.7, -0.2, ∗ varest <- VAR(svardat, p = 2, type = "none") ∗ 0.7, 1, 0.5, -0.3) , ∗ ## Setting up matrices for A-model ∗ c(3, 2, 2)) ∗ Amat <- diag(2) ∗ ## Setting covariance to identity-matrix ∗ Amat[2, 1] <- NA ∗ B <- diag(2) ∗ Amat[1, 2] <- NA ∗ ## Generating the VAR(2) model ∗ ## Estimating the SVAR A-type by direct ∗ svarA <- ARMA(A = Apoly, B = B) maximisation ∗ ## Simulating 500 observations ∗ ## of the log-likelihood ∗ svarsim <- simulate(svarA, sampleT = 500, ∗ args(SVAR) ∗ svar.A <- SVAR(varest, estmethod = "direct", ∗ rng = list(seed = c(123456))) ∗ Amat = Amat, hessian = TRUE)
  • 16. SVAR: B-model ∗ library(dse1) ∗ ## Simulating 500 observations ∗ library(vars) ∗ svarsim <- simulate(svarB, sampleT = 500, ∗ ## B-model ∗ rng = list(seed = c(123456))) ∗ svardat <- matrix(svarsim$output, nrow = 500, ∗ Apoly <- array(c(1.0, -0.5, 0.3, 0, ncol = 2) ∗ 0.2, 0.1, 0, -0.2, ∗ colnames(svardat) <- c("y1", "y2") ∗ 0.7, 1, 0.5, -0.3) , ∗ varest <- VAR(svardat, p = 2, type = "none") ∗ c(3, 2, 2)) ∗ ## Estimating the SVAR B-type by scoring algorithm ∗ ## Setting covariance to identity-matrix ∗ ## Setting up the restriction matrix and vector ∗ B <- diag(2) ∗ ## for B-model ∗ B[2, 1] <- -0.8 ∗ Bmat <- diag(2) ∗ ## Generating the VAR(2) model ∗ Bmat[2, 1] <- NA ∗ svarB <- ARMA(A = Apoly, B = B) ∗ svar.B <- SVAR(varest, estmethod = "scoring", ∗ Bmat = Bmat, max.iter = 200)
  • 17. ## Impulse response analysis of ## FEVD analysis of SVAR B-type SVAR A-type model model ∗ args(vars:::irf.svarest) ∗ args(vars:::fevd.svarest) ∗ irf.svara <- irf(svar.A, impulse = ∗ fevd.svarb <- fevd(svar.B, n.ahead "y1", response = "y2", boot = = 5) FALSE) ∗ class(fevd.svarb) ∗ args(vars:::plot.varirf) ∗ methods(class = "varfevd") ∗ plot(irf.svara) ∗ plot(fevd.svarb)