SimMarketModel: Simulating a Market Model

Description Usage Arguments Details Value See Also Examples

Description

The function SimMarketModel is used to simulate a market model defined by a marketmodel object. The output is a toymkt object with which further analysis can be performed.

Usage

1
2
3
SimMarketModel(model, n.years = 10, frequency = 12,
               initial.weight = rep(1/model$n, model$n),
               sub.freq = 1)

Arguments

model

a marketmodel object.

n.years

an integer which is the number of years of data to be simulated. The default value is 10.

frequency

an integer which is the number of periods for each year. The default value is 12, i.e., monthly data is generated.

initial.weight

a numeric vector of positive numbers representing the initial weights of each stock. The default value is rep(1/model$n, model$n), i.e., the market is equal-weighted initially.

sub.freq

a positive integer, which is the number of subperiods within each period. The default value is 1. This is included to allow more accurate simulation of models defined by stochastic differential equations.

Details

The function SimMarketModel simulates a given market model with user-defined parameters. See marketmodel for the definition of a market model.

The option sub.freq does the following. Suppose we set frequency = 12 and sub.freq = 4. Although the output is monthly prices, during the simulation, for each month the algorithm divides in month into 4 subperiods (say 4 weeks). In other words, the actual time step in the simulation is

dt = 1 / frequency * subfreq,

and the output shows only the prices sampled monthly. This feature allows more accurate simulation of rank-based models, where multiple changes in rankings can happen within each sampling period.

When the aim is to simulate the evolution of capital distribution curves, the initial market weights play an important role. The default option is equal-weighting. To start the market at stationarity, there are three ways to proceed:

1) Remove an initial segment of the output.

2) Perform two simulations, where in the second simulation the market is started at the ending distribution of the first simulation.

3) Use the long term distribution (say Pareto with a certain slope parameter) directly if it is known. A possibility is to use ParetoCapDist.

Value

A toymkt object containing the simulated market. For this object buy.and.hold is TRUE.

See Also

AtlasModel, marketmodel, VolStabModel

Examples

1
2
3
4
5
6
7
8
9
# Create an Atlas model of 5 stocks
model <- AtlasModel(n = 5, g = 0.05, sigma = 0.1)

# Simulate the model to get 20 years of monthly data
# with initial weights c(0.1, 0.2, 0.2, 0.2, 0.3)
market <- SimMarketModel(model, n.years = 20, 
                          initial.weight = c(0.1, 0.2, 0.2, 0.2, 0.3), 
                          frequency = 12)
plot(market)

Example output

Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

RelValAnalysis documentation built on May 2, 2019, 3:09 a.m.