Skip to content

This repository contains an RMarkdown file that performs an econometric analysis of soybean prices using various statistical methods, including cointegration tests, ECM, and GARCH models.

License

Notifications You must be signed in to change notification settings

ejb1987/R_Econometric

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Econometric Analysis with R

This repository contains an RMarkdown document that performs an econometric analysis on soybean spot and future price data using various statistical and econometric techniques. The study is presented in both code and results form, with the RMarkdown file generating an HTML document for easy viewing.

Table of Contents

Description

This project performs an econometric analysis focusing on soybean prices, including the use of techniques such as:

  • Natural logarithm transformations
  • Time series analysis including Augmented Dickey-Fuller tests
  • Cointegration tests and Error Correction Models (ECM)
  • AR(1) models
  • GARCH and GJR-GARCH models for volatility modeling

The RMarkdown file generates plots and performs statistical tests to analyze the data, producing an HTML document that includes both the code and its outputs.

Installation

To run this analysis, you'll need to have R installed on your system, along with the following packages:

install.packages(c("readxl", "ggplot2", "scales", "tseries", "urca", "dplyr", "stargazer", "FinTS", "rugarch", "knitr"))

Ensure that you have these packages installed before running the RMarkdown file.

Usage

  1. Clone this repository to your local machine:

    git clone https://github.com/yourusername/repo-name.git
  2. Navigate to the directory containing the index.Rmd file.

  3. Run the RMarkdown file to generate the HTML output:

    rmarkdown::render("index.Rmd")

    This will produce an HTML file in the same directory that contains the full analysis.

Data

The analysis uses an Excel file (Final.xlsx) containing soybean spot and future price data. This file should be placed in the same directory as the RMarkdown file before running the analysis.

The specific columns analyzed include:

  • soy_s: Spot prices of soybean
  • soy_f: Future prices of soybean
  • Date: Date column to represent the time series

The analysis includes subsetting the data, creating new variables through logarithmic transformations, and dropping irrelevant columns.

Analysis and Methods

1. Data Preprocessing

  • Loading and subsetting data from an Excel file.
  • Transforming price data using natural logarithms.

2. Time Series Analysis

  • Augmented Dickey-Fuller tests on the original and differenced time series.
  • Cointegration tests to assess long-term relationships between spot and forward prices.
  • Error Correction Model (ECM) to explore short-term dynamics.

3. Volatility Modeling

  • AR(1) model to analyze the autoregressive structure of log returns.
  • GARCH and GJR-GARCH models to model conditional volatility.

4. Model Comparison

  • Information criteria (Akaike, Bayes, Shibata, HQ) are used to compare GARCH and GJR-GARCH models.

Results

The results of the analysis include plots of the natural logarithms of the soybean prices, time series plots, and summaries of the statistical models used. The findings are presented in an easy-to-read HTML document generated by RMarkdown.

Demo

https://ejb1987.github.io/R_Econometric/index.html

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This repository contains an RMarkdown file that performs an econometric analysis of soybean prices using various statistical methods, including cointegration tests, ECM, and GARCH models.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages