portfoliowalkr: The Portfoliowalkr function

Description Usage Arguments Details Value Examples

View source: R/portfoliowalkr.R

Description

Given an asset universe A and a vector of baseline weights with which to calculate target portfolio characteristics b, portfoliowalkr samples points from the intersection of Ax = b with the n-simplex (∑ x = 1, x_i ≥ 0).

Usage

1
2
3
portfoliowalkr(universe, match, portfolio.weight = "portfolio",
  ret.var = "return", points = 1000, method = "dikin", chains = 1,
  thin = 1, burn = 0.5)

Arguments

universe

is the universe of stocks available for sampling, with dates, returns, weights, and any desired characteristics

match

is the list of columns containing characteristics to be matched

portfolio.weight

is the name of the column containing the weights of the target portfolio

ret.var

is the name of the column containing percentage return over the time period

points

is the number of points we want to sample

method

is the MCMC sampling method. Please enter "hit-and-run" or "dikin"

chains

is the number of chains run

thin

every thin-th point is stored

burn

the first burn points are deleted

Details

portfoliowalkr, per its namesake, makes use of the walkr package to sample randomly from the space of characteristic-matched portfolios. portfoliowalkr returns points vectors of weights, which when applied to the universe A yields a portfolio with the same characteristics as the target.

Per walkr:

1) Hit-and-run is computationally less expensive and also guarantees uniformity asympotically with complexity of O(n^3) points with respect to dimension n. However, in real practice, as dimensions ramp up, the mixing of hit-and-run is poor compared to Dikin. Thus, a lot of thinning would be needed as dimension ramps up.

2) Dikin Walk is a nearly uniform method known for its very strong mixing properties. However, each Dikin step is much more computationally expensive than hit-and-run, so it takes more time to sample every point. Thus, the "dikin" method uses RcppEigen to speed up the core computationally expensive operations in the algorithm.

Value

A list of objects for assessing portfolio performance. $plot returns a histogram of random portfolio performances with target portfolio and universe performances demarcated for comparison. $summary returns a numeric description of these performances. $frame returns the universe frame with matched weights attached. $returns is a frame containing each portfolios' return, including one evenly weighted within the universe for comparison. $explore is a list of chains from the walkr output which can be input into the explore_walkr function to better understand the convergence of the model.

Examples

1
2
3
match_list <- portfoliowalkr(universe = jan, match = c('sector', 'growth', 'size'), points = 100, method = "dikin")       
match_list$frame
                                                                                             

jluby/portfoliowalkr documentation built on April 4, 2020, 1:46 a.m.