Sample 47854: Inserting Rare Events into a Simulation (SAS Risk Dimensions)
Overview
When you perform risk analysis, two common assessment techniques are simulation and stress scenarios. Simulations are often based on behavior that you have observed in the past. A shortcoming to that approach is that simulations can fail to capture extreme events. These are events that might never have occurred, or might have occurred with such infrequency that they are not realized in simulation. Stress scenarios, on the other hand, look exclusively at extreme events. They predict the likelihood that such an event will occur.
SAS Risk Dimensions enables you to incorporate stress scenarios into a simulation. You can define a rare event and assign it a probability of occurrence. As a simulation model runs, it randomly triggers the rare event. For example, you can define a rare event such as the .005% chance that a stock price will decrease $10 in one day. On average, you should see that the rare event occurs in the simulation with a frequency equal to the probability that you specify .
You can also assign a conditional probability to the rare event that assigns the likelihood of occurrence given that the event occurred in a previous horizon. This captures the notion of increased risk following an extreme event.
Objective
In this example you simulate the value of a portfolio containing two shares of stock (see "Assessing Market Risk" for more information). You generate 50,000 market states and calculate the portfolio's value and profit/loss at each market state. You also define two stress scenarios, a BankCompany shock in which BNK stock drops $0.50/share and a TechCompany shock in which TEC stock drops 20%.
You assign a probability and conditional probability to the stress scenarios by creating a rare event probability data set. When the simulation is run, the stress scenarios are randomly triggered according to the probabilities you specify in that data set.
When the project has run, look at the output data set named RareEvents to see when the stress scenarios were triggered during simulation.
Setting Up and Running the Example
To learn how to setup the environment, register your data, create and run the project, please go to
Inserting Rare Events into a Simulation on the Risk Dimension product page.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Run the project, putting output files in the RareEvt subdirectory of the environment directory.
proc risk;
env open=RDExamp.&test_env;
setoptions keeplib;
runproject Project
out = RareEvt
options=(outall rareevents)
;
env save;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
After opening the environment in the SAS Risk Dimensions GUI, you can create a JMP histogram plot of simulated values. The plots below
compare the BankCompany holding in horizon one and horizon two. In the first plot, notice the rare event in horizon one, which is illustrated
by the bar on the left at -$500,000 profit. The second plot depicts three possible outcomes for BankCompany:
- Another rare event occurred , illustrated by the values in the leftmost bar.
- The first rare event occurred, illustrated by the values in the middle cluster of bars.
- Still no rare events occurred, illustrated by the cluster of bars at the right of the plot.
Use the SAS Program
Use this zip file to obtain the complete SAS program provided in this example.
Rare events zip file
SAS Risk Dimensions enables you to incorporate stress scenarios into a simulation. You can define a rare event and assign it a probability of occurrence. As a simulation model runs, it randomly triggers the rare event. This example will show you how this is done.
Date Modified: | 2016-10-17 14:05:38 |
Date Created: | 2012-09-11 12:06:59 |
Operating System and Release Information
SAS System | SAS Risk Dimensions Configuration | Microsoft® Windows® for x64 | 5.4 | | | |
Microsoft Windows 8 | 5.4 | | | |
Microsoft Windows 95/98 | 5.4 | | | |
Microsoft Windows 2000 Advanced Server | 5.4 | | | |
Microsoft Windows 2000 Datacenter Server | 5.4 | | | |
Microsoft Windows 2000 Server | 5.4 | | | |
Microsoft Windows 2000 Professional | 5.4 | | | |
Microsoft Windows 2012 | 5.4 | | | |
Microsoft Windows NT Workstation | 5.4 | | | |
Microsoft Windows Server 2003 Datacenter Edition | 5.4 | | | |
Microsoft Windows Server 2003 Enterprise Edition | 5.4 | | | |
Microsoft Windows Server 2003 Standard Edition | 5.4 | | | |
Microsoft Windows Server 2003 for x64 | 5.4 | | | |
Microsoft Windows Server 2008 | 5.4 | | | |
Microsoft Windows Server 2008 for x64 | 5.4 | | | |
Microsoft Windows XP Professional | 5.4 | | | |
Windows 7 Enterprise 32 bit | 5.4 | | | |
Windows 7 Enterprise x64 | 5.4 | | | |
Windows 7 Home Premium 32 bit | 5.4 | | | |
Windows 7 Home Premium x64 | 5.4 | | | |
Windows 7 Professional 32 bit | 5.4 | | | |
Windows 7 Professional x64 | 5.4 | | | |
Windows 7 Ultimate 32 bit | 5.4 | | | |
Windows 7 Ultimate x64 | 5.4 | | | |
Windows Millennium Edition (Me) | 5.4 | | | |
Windows Vista | 5.4 | | | |
Windows Vista for x64 | 5.4 | | | |
64-bit Enabled AIX | 5.4 | | | |
64-bit Enabled HP-UX | 5.4 | | | |
64-bit Enabled Solaris | 5.4 | | | |
HP-UX IPF | 5.4 | | | |
Linux | 5.4 | | | |
Linux for x64 | 5.4 | | | |
Solaris for x64 | 5.4 | | | |