trade.distance {PortfolioProbe}R Documentation

Trade distance

Description

Returns the trade distance between two portfolios.

Usage

trade.distance(x, y, prices = NULL, scale = TRUE, tol = 1e-6)

Arguments

x an object that is the result of trade.optimizer or a named vector representing a portfolio.
y an object that is the result of trade.optimizer or a named vector representing a portfolio.
prices a named vector of prices of the assets in the portfolios. If NULL, then the prices components from x and/or y are used.
scale either a logical value or a string that is (an abbreviation of) one of: "x", "y", "min", "max", "mean", "weight". If FALSE, then the answer is the value (buys plus sells) of the trade. If TRUE, then the trade value is divided by the gross value of x. If a string, then the trade value is divided by the gross value of one of the portfolios, by the minimum gross value, by the maximum gross value, or by the mean gross value.
If "weight", then the weights are found first and the differences are taken afterwards – in this case the distance can be zero if the gross values of the two portfolios differ. Also in this case, "x" and/or "y" can be given as weight vectors – if the sum of absolute values is within tol of 1, then the vector is considered a weight vector.
tol a single number giving the tolerace for testing if a vector is a weight vector, and the relative tolerance for two prices for the same asset being equal.

Value

a number. If scaling is done and the gross values of the two portfolios are equal, then the maximum possible is 2.

Revision

This help was last revised 2010 April 28.

See Also

trade.optimizer.

Examples

op1 <- trade.optimizer(prices, varmat, gross.value=9e7, 
        long.only=TRUE)
op2 <- update(op1, seed=NULL)
trade.distance(op1, op2)

[Package PortfolioProbe version 1.03 Index]