Skip to contents

portfolio_kappa() is a unit's conditional expectation given the total, kappa_i(x) = E[X_i | X = x], at each of the portfolio's distinct totals (port@totals, ascending); the units' kappas add up to the total. As Python's Portfolio.kappa(unit).

Usage

portfolio_kappa(port, unit)

portfolio_assets(port, p)

Arguments

port

A capital_portfolio.

unit

The unit, by name or by its 1-based position in port@units.

p

The capital standard, in [0, 1].

Value

portfolio_kappa(): a numeric vector, one value per distinct total. portfolio_assets(): a number.

Details

portfolio_assets() is the assets at the capital standard p: the total's lower p quantile, the level natural_price() uses when given p. As Python's Portfolio.assets(p).

Examples

insco <- capital_portfolio(cbind(
  A = c(15, 15, 5, 7, 13, 5, 15, 26, 17, 16),
  B = c(7, 13, 20, 33, 20, 27, 16, 19, 8, 20),
  C = c(0, 0, 11, 0, 7, 8, 9, 10, 40, 64)
))
insco@totals
#> [1]  22  28  36  40  55  65 100
portfolio_kappa(insco, "A")
#> [1] 15 15  5 10 26 17 16
portfolio_kappa(insco, 3)
#> [1]  0  0 11  6 10 40 64
portfolio_assets(insco, 0.8)
#> [1] 55