Giter VIP home page Giter VIP logo

petrgarm / favar Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 5.0 49.51 MB

This implementation is inspired by the seminal work of Ben S. Bernanke, Jean Boivin, and Piotr Eliasz in their influential article, "Measuring the Effects of Monetary Policy: A Factor-Augmented Vector Autoregressive (FAVAR) Approach", published in the Quarterly Journal of Economics in 2005.

License: MIT License

R 20.96% MATLAB 15.86% M 0.05% TeX 63.08% Mercury 0.04%

favar's Introduction

FAVAR Implementation in R

Welcome to the FAVAR (Factor Augmented Vector Auto-Regression) R implementation repository! This repository provides a comprehensive implementation of a FAVAR model for forecast prediction tasks in R.

Table of Contents

  • Introduction
  • Installation
  • Usage
    • Function Parameters
    • Example
  • Dependencies
  • Contributing
  • License

Introduction

FAVAR (Factor Augmented Vector Auto-Regression) is an advanced econometric model that extends the standard VAR (Vector Auto-Regression) model by incorporating factors extracted from a large dataset. This approach can improve forecast accuracy by leveraging a broader information set.

This implementation allows you to fit a FAVAR model and make forecasts using your own dataset in a seamless manner.

Installation

To get started, you need to clone the repository and install the required R packages:

git clone https://github.com/PetrGarm/FAVAR.git
cd FAVAR/Code/my experiments/FAVAR_CV.R

Next, ensure you have the necessary R packages installed:

install.packages(c("tidyverse", "forecast", "vars", "lmtest"))

The main function provided by this repository is fore_FAVAR, which takes in your dataset and parameters and returns the forecast results.

Function Parameters

  • X: A matrix or data frame containing the predictors.
  • Y: A matrix or data frame containing the dependent variable(s).
  • K: The number of factors to extract from X.
  • y_name: The name of the dependent variable in Y to be forecasted.
  • h: The forecast horizon.
  • y: (Optional and must not be changed probably) A time series object of the dependent variable. Defaults to Y[,y_name].
  • use_VAR: (Optional) Logical flag to use standard VAR without factors if TRUE. Defaults to FALSE.

Example

# Sample usage of the fore_FAVAR function
source("FAVAR_CV.R")


# Define your data
X <- ...  # Your predictors matrix
Y <- ...  # Your dependent variables matrix
K <- 3    # Number of factors to extract
y_name <- "target_variable"  # The name of the dependent variable to forecast
h <- 12   # Forecast horizon

# Run FAVAR
forecast_result <- fore_FAVAR(X, Y, K, y_name, h)

# Display forecast results
print(forecast_result)

Repository Structure

This repository is organized into the following directories:

  • Code: Contains the R scripts and code implementations
  • Diploma: Includes any diploma-related documents and resources
  • Literature: Stores research papers, articles, and other relevant literature
  • Project Proposals: Contains project proposal documents and related resources
  • plots: Stores plot images generated from the analysis

Dependencies

The following R packages are required to run the FAVAR implementation:

  • tidyverse
  • forecast
  • vars
  • lmtest

Ensure they are installed and loaded into your R environment before running the fore_FAVAR function.

Contributing

Contributions to this repository are welcome. If you have any improvements, bug fixes, or new features, feel free to open a pull request or issue.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

favar's People

Contributors

petrgarm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

favar's Issues

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.