Vine_Copula_Sim: C and D-vine Copula - Simulation

View source: R/Vine_Copula_Sim.R View source: R/Vine_Copula_Sim.R

Vine_Copula_SimR Documentation

C and D-vine Copula - Simulation

Description

Simulating from specified C- and D-vine copula models. Function is a repackaging of the RVineMatrix and RVineMatrix functions from the VineCopula package into a single function.

Usage

Vine_Copula_Sim(Data, Vine_Model, Marginals, mu = 365.25, N = 10000)

Arguments

Data

Data frame containing n at least partially concurrent time series. First column may be a "Date" object. Can be Dataframe_Combine output.

Vine_Model

An RVineMatrix object i.e., output of Vine_Copula_Fit specifying the structure and copula families composing the vine copula.

Marginals

An migpd object containing the d-independent generalized Pareto models.

mu

(average) Number of events per year. Numeric vector of length one. Default is 365.25, daily data.

N

Number of years worth of extremes to be simulated. Numeric vector of length one. Default 10,000 (years).

Value

List comprising an integer vector specifying the pair-copula families composing the C- or D-vine copula Vine_family, its parameters Vine_par and Vine_par2 and type of regular vine Vine_Type. In addition, data frames of the simulated observations: u.Sim on the transformed $[0,1]^n$ and x.Sim the original scales.

See Also

Vine_Copula_Fit

Examples

#Fitting vine copula
S20.Vine<-Vine_Copula_Fit(Data=S20.Detrend.df)
#Simulating from fitted copula
S20.Vine.Sim<-Vine_Copula_Sim(Data=S20.Detrend.df,Vine_Model=S20.Vine,
                              Marginals=S20.Migpd,N=10)
#Plotting observed (black) and simulated (red) values
S20.Pairs.Plot.Data<-data.frame(rbind(na.omit(S20.Detrend.df[,-1]),S22.Vine.Sim$x.Sim),
                                c(rep("Observation",nrow(na.omit(S20.Detrend.df))),
                                rep("Simulation",nrow(S20.Vine.Sim$x.Sim))))
colnames(S20.Pairs.Plot.Data)<-c(names(S20.Detrend.df)[-1],"Type")
pairs(S20.Pairs.Plot.Data[,1:3],
      col=ifelse(S20.Pairs.Plot.Data$Type=="Observation","Black","Red"),
      upper.panel=NULL)

rjaneUCF/MultiHazard documentation built on April 20, 2024, 12:48 a.m.