COPULA Procedure

Getting Started: COPULA Procedure

(View the complete code for this example.)

The following example illustrates the use of PROC COPULA. The data used are daily returns on several major stocks. The main purpose of this example is to estimate the joint distribution of stock returns and then simulate from this distribution a new sample of specified size.

Figure 1 shows the first 10 observations of the daily stock return data set.

Figure 1: First 10 Observations of Daily Returns

Obsdateret_msftret_koret_ibmret_dukret_bp
101/03/20080.0041820.0103670.0020020.0035030.019114
201/04/2008-0.0279600.001913-0.035861-0.000582-0.014536
301/07/20080.0067320.023607-0.0106710.0256110.017922
401/08/2008-0.0334350.004239-0.024610-0.002838-0.016049
501/09/20080.0295600.0266800.0073010.010814-0.027078
601/10/2008-0.0030540.0044410.016414-0.001689-0.004395
701/11/2008-0.012255-0.027346-0.022546-0.012408-0.018473
801/14/20080.0139580.0084180.0538570.0034270.001166
901/15/2008-0.011318-0.010851-0.010689-0.017075-0.040925
1001/16/2008-0.022587-0.015021-0.0019550.002316-0.021336


The following statements fit a normal copula to the returns data (with the FIT statement) and create a new SAS data set that contains parameter estimates of the model. The VAR statement specifies the list of variables, which in this case are the daily returns of five large company stocks.

/* Copula estimation */
proc copula data = returns;
   var ret_ibm ret_msft ret_bp ret_ko ret_duk;
   fit normal / outcopula=estimates;
run;

The first table in Figure 2 shows some general information about the copula fitting procedure: the number of observations, the name of the input data set, the type of model, and the correlation matrix.

Figure 2: Copula Estimation: Fit Summary and Correlation Matrix

The COPULA Procedure

Model Fit Summary
Number of Observations603
Data SetWORK.RETURNS
Copula TypeNormal

Correlations Matrix
 ret_ibmret_msftret_bpret_koret_duk
ret_ibm1.00000.62320.52940.47250.4902
ret_msft0.62321.00000.52290.50150.4567
ret_bp0.52940.52291.00000.39800.4378
ret_ko0.47250.50150.39801.00000.5283
ret_duk0.49020.45670.43780.52831.0000


Next, the following statements restrict the data set to only those columns that contain correlation parameter estimates:

/* keep only correlation estimates */
data estimates;
   set estimates;
   keep ret_ibm ret_msft ret_bp ret_ko ret_duk;
run;

Then, in the following statements, the DEFINE statement specifies a normal copula named COP, and the CORR= option specifies that the data set Estimates be used as the source for the model parameters. The NDRAWS=500 option in the SIMULATE statement generates 500 observations from the normal copula. The OUTUNIFORM= option specifies the name of SAS data set to contain the simulated sample with uniform marginal distributions. Note that this syntax does not require the DATA= option.

/* Copula simulation of uniforms */
proc copula;
   var ret_ibm ret_msft ret_bp ret_ko ret_duk;
   define cop normal (corr = estimates);
   simulate cop / ndraws     = 500
                  seed       = 1234
                  outuniform = simulated_uniforms
                  plots=(datatype=uniform);
run;

The simulated data are contained in the new SAS data set, Simulated_Uniforms. A scatter plot matrix of uniform marginals contained in the data set is shown in Figure 3.

Figure 3: Simulated Data, Uniform Marginals

Simulated Data, Uniform Marginals


The preceding sequence of PROC COPULA usage—first fit, then simulate given estimated parameters—is a legitimate sequence but has a limitation in that the second COPULA call does not generate the sample according to the empirical distribution of the raw data. It generates only marginally uniform series.

In the following statements, the FIT statement fits a t copula to the returns data and at the same time simulates the sample according to empirical marginal distributions:

/* Copula estimation and simulation of returns */
proc copula data = returns;
   var ret_ibm ret_msft ret_bp ret_ko ret_duk;
   fit T;
   simulate / ndraws = 1000
              seed   = 1234
              out    = simulated_returns;
run;

The output of the statements is similar in structure to the output displayed in Figure 2 with the addition of parameter estimates and inference statistics that are specific to the copula model as shown in Figure 4. For a t copula, the degrees of freedom are displayed (as in Figure 4); for Archimedean copulas, the parameter "theta" is displayed; and for a normal copula, this table is not printed.

Figure 4: Copula Estimation: Specific Parameter Estimates

The COPULA Procedure

Parameter Estimates
ParameterEstimateStandard
Error
t ValueApprox
Pr > |t|
DF3.6592990.32058311.41<.0001


The simulated data are contained in the new SAS data set, Simulated_Returns.

Last updated: June 19, 2025