trade.distance {PortfolioProbe} | R Documentation

## Trade distance

### Description

Returns the trade distance between two portfolios.

### Usage

    trade.distance(x, y, price = NULL, scale = TRUE)

### 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.
`price` | 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.

### 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 January 02.

### 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.00 Index]