Implement the portfolio selction defined by Gyorfi. At each instant in time, look back for a set of nearest neighbors, then find the best CRP for the time steps following the nearest neighbors and use the corresponding weights for the next time step. This is done for a set of parameters, defining so-called experts. The final performance is the (weighted) average across all experts.

1 |

`x` |
Time series of relative prices |

`pls` |
pls is either a scalar or a sequence. If its a scalar, it is the value L as defined in Gyorfi article, and the pl sequence is 0.02 + 0.05 * (l-1)/(L-1), l in 1:L. Otherwise pls is the sequence of pl values itself. |

`ks` |
ks is either a scalar or a sequence. If its a scalar, it is the value K as defined in Gyorfi article, and the k sequence is 1:K. Otherwise ks is the sequence of k values itself. |

`qkl` |
A priori weights for the experts, this is a matrix (K,L) that should sum to 1. The NULL default results in an uniform loading. |

Straightforward implementation of the nearest neighbors portfolio algorithm.

Return a list containing in order the set of weights and wealth evolution corresponding to all combinations of pl and k values.

Marc Delvaux

L. Gyorfi, F. Udina and H. Walk, "Nonparametric nearest neighbor based empirical portfolio selection strategies", Statistics & Decisions, 26:145-157, 2008.

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.