Git Product home page Git Product logo

var-fevar's Introduction

feVAR

Estimation and analysis of fixed effects vector autoregressive models

feVAR is an R package implementing bias-corrected least squares estimation for fixed effects vector autoregressive models (Dhaene & Jochmans, 2016), together with several post-estimation functionalities. Both panel and non-panel data are allowed.

G. Dhaene, and K. Jochmans (2016). Bias-corrected estimation of panel vector autoregressions. Economics Letters, 145: 98-103. DOI: 10.1016/j.econlet.2016.06.010

R (The R Project for Statistical Computing) needs to be installed on your system in order to use the feVAR package. R can be downloaded from https://www.r-project.org/.

To install the feVAR package, open the console of R and type:

install.packages("devtools")  ## do not run if package 'devtools' is already installed
library(devtools)
install_github("alessandromagrini/feVAR")

For any request or feedback, please write to [email protected] (Alessandro Magrini)

Below, you find some examples of use of the package.


Load the feVAR package

library(feVAR)

Load data on EU agricultural sustainability indicators

data(agrisus2020)

Estimation of a fixed effects vector autoregressive model:

# names of endogenous variables
varNames <- colnames(agrisus2020)[4:15]

# fit a model with p=1 on data in logarithmic differences ('box.cox'=0 and 'ndiff'=1)
#   exogenous variable: GDP (optional)
m_agr <- feVAR(varNames, unit="Country", time="Year", exogenous="GDP",
  data=agrisus2020, box.cox=0, ndiff=1, nlags=1)

# automated selection of the lag order based on BIC
m_agr_auto <- feVAR(varNames, unit="Country", time="Year", exogenous="GDP",
  data=agrisus2020, box.cox=0, ndiff=1, ic="bic", max.nlags=4)

Summary of parameter estimation:

summary(m_agr)

Stability check:

eig0 <- stabilityCheck(m_agr)
which(eig0>=1)  ## no eigenvalue greater or equal to 1 -> stable

Graphical diagnostics:

# time series plot of residuals
residualPlot(m_agr, type="ts", cex.main=1.1)
# autocorrelogram of residuals
residualPlot(m_agr, type="acf", cex.main=1.1)
# normal quantile plot of residuals
residualPlot(m_agr, type="qq", cex.main=1.1)
# fitted versus residuals
residualPlot(m_agr, type="fitVSres", cex.main=1.1)

Graphical functionalities for prediction:

# predictions for the first four variables on unit 'Italy'
predictPlot(m_agr, unit.id="Italy", var.names=varNames[1:4]) ## in-sample
predictPlot(m_agr, unit.id=15, var.names=1:4)                ## same as before
predictPlot(m_agr, unit.id=15, var.names=1:4, n.ahead=3)     ## 3 steps ahead

var-fevar's People

Contributors

alessandromagrini avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.