---
output:
  html_document: default
  pdf_document: default
---

# 1. Introduction

In this file, we describe the data and code files of "A Vine Copula Model for Climate Trend Analysis using Canadian Temperature Data" submitted for Journal of Data Science. 

There are 2 folders, which is

* Simulation

* Data_Application


# 2. Simulation
In this folder, it includes the R codes for the "Simulation" section in the manuscript. Specifically, there are 5 folders in it:

* Efficiency

* Robustness

* Copula_Selection

* Prediction_Time_Extrapolation

* Prediction_Subject_Extrapolation

## 2.1 Efficiency
In this folder, it includes the R codes for the "Efficiency and Validity" section of the simulation studies in the manuscript. Specifically, there are 4 files:

* composite_likelihood_simultaneous.R : the code for the procedure of composite likelihood with simultaneous estimation.

* composite_likelihood_twostage_estimation.R : the code for the procedure of composite likelihood with two-stage estimation.

* full_likelihood_simultaneous.R: the code for the procedure of full likelihood with simultaneous estimation.

* full_likelihood_twostage_estimation.R : the code for the procedure of full likelihood with two-stage estimation.


## 2.2 Robustness

In this folder, it includes the R codes for the "Robustness" section of the simulation studies in the manuscript. The structure is similar to that of "Efficiency" folder, just with different simulation settings. Specifically, there are 4 files:

* composite_likelihood_simultaneous_robustness.R : the code for the procedure of composite likelihood with simultaneous estimation under model mis-specification settings.

* composite_likelihood_twostage_estimation_robustness.R : the code for the procedure of composite likelihood with two-stage estimation under model mis-specification settings.

* full_likelihood_simultaneous_robustness.R: the code for the procedure of full likelihood with simultaneous estimation under model mis-specification settings.

* full_likelihood_twostage_robustness.R : the code for the procedure of full likelihood with two-stage estimation under model mis-specification settings.

## 2.3 Copula_Selection

In this folder, it includes the R codes for the "Copula Selection" section of the simulation studies in the manuscript. There is just one file in this folder:

 * misselected.R: calculate the mis-selection rate of copula forms using the composite likelihood procedure.
 

## 2.4 Prediction_Time_Extrapolation

In this folder, it includes the R codes for the prediction in time extrapolation of the simulation studies in the manuscript. Specifically, there are 6 files in this folder, with each file corresponding to one scenario.

* Prediction_Scenario_1_Time_Extrapolation.R

* Prediction_Scenario_2_Time_Extrapolation.R

* Prediction_Scenario_3_Time_Extrapolation.R

* Prediction_Scenario_4_Time_Extrapolation.R

* Prediction_Scenario_5_Time_Extrapolation.R

* Prediction_Scenario_6_Time_Extrapolation.R

As indicated by the name of the files, the 6 files are the simulation code for 6 scenarios in time extrapolation setting of prediction. 

## 2.5 Prediction_Subject_Extrapolation

In this folder, it includes the R codes for the prediction in subject extrapolation of the simulation studies in the manuscript. Specifically, there are 6 files in this folder, with each file corresponding to one scenario.

* Prediction_Scenario_1_Subject_Extrapolation.R

* Prediction_Scenario_2_Subject_Extrapolation.R

* Prediction_Scenario_3_Subject_Extrapolation.R

* Prediction_Scenario_4_Subject_Extrapolation.R

* Prediction_Scenario_5_Subject_Extrapolation.R

* Prediction_Scenario_6_Subject_Extrapolation.R

As indicated by the name of the files, the 6 files are the simulation code for 6 scenarios in subject extrapolation setting of prediction. 


# 3. Data_Application

In this folder, it includes the data and R codes for the "Data_Application" section in the manuscript. Specifically, there are 3 folders and 1 file:

* Data: this folder includes all the data files of homogenized Canadian surface air temperature, with each file corresponding to one meteorology station. 

* Time_Extrapolation: this folder includes all the codes for time extrapolation in the "Data_Application".
   
  - time_extrapolation.R: the prediction code for time extrapolation of each months,given that we know the information from previous months. 
  
  - time_extrapolation_prediction.R: the prediction code for time extrapolation of month 4-12, given the first 3 months
  
  - SARIMA.R: the prediction code of SARIMA model for time extrapolation
  
  - Boxplot: the code and csv files for creating boxplots in the manuscript.

* Subject_Extrapolation: this folder includes all the codes for subject extrapolation in the "Data_Application". As indicated by the name of the files, each contains the prediction codes for a meteorology station. Similar to the Time_Extrapolation folder, the files with only the station name (e.g., Atitokan.R) are the prediction codes for subject extrapolation of each months,given that we know the information from previous months, and the files with the "station_prediction" (e.g., Atitokan_prediction.R) are the prediction codes for time extrapolation of month 4-12, given the first 3 months.

  - Atitokan.R
  
  - Atitokan_prediction.R

  - Beatrice.R
  
  - Beatrice_prediction.R
  
  - Big Trout Lake.R 
  
  - Big Trout Lake_prediction.R
  
  - Harrow.R
  
  - Harrow_prediction.R
  
  - Sioux Lookout.R
  
  - Sioux Lookout_prediction.R

* Estimation_Analysis.R: this file includes the code for the estimation of statistical models in the "Data Application" section of the manuscript. 