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.
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.
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.
-
Clone this repository to your local machine:
git clone https://github.com/yourusername/repo-name.git
-
Navigate to the directory containing the
index.Rmd
file. -
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.
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 soybeansoy_f
: Future prices of soybeanDate
: Date column to represent the time series
The analysis includes subsetting the data, creating new variables through logarithmic transformations, and dropping irrelevant columns.
- Loading and subsetting data from an Excel file.
- Transforming price data using natural logarithms.
- 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.
- AR(1) model to analyze the autoregressive structure of log returns.
- GARCH and GJR-GARCH models to model conditional volatility.
- Information criteria (Akaike, Bayes, Shibata, HQ) are used to compare GARCH and GJR-GARCH models.
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.
https://ejb1987.github.io/R_Econometric/index.html
This project is licensed under the MIT License - see the LICENSE file for details.