Wrapper to iterate E and M steps.

EM(Rr, Rf, max_iteration = 100, valuefunction = value_varmean, M = NROW(Rr[[1]]), Tn = length(Rr) - 1, ini_W = 1000, discount = 1/1.01, lambda = 1/2, para = NULL, early_stop = ceiling(max_iteration/5))

Rr | List of matrix. The rertuns of the assets. Each list is for one time point and each column in the matrix is one assets. |
---|---|

Rf | Scalar. The risk free rate. e.g. 1.01 |

valuefunction | Function. The function that returns the value being optimised. The first argument needs to be the parameter to optimise. |

M | Integer. The number of instances for one assets at a time |

Tn | Integer. The length of time horizon. Not including 0. |

ini_W | Scalar. The initial wealth. |

discount | Scalar. The rate of discount. e.g. 1/1.01 |

lambda | The scalar that make the calculation easiler. |

para | Matrix. Initial value of all the paramters. Each column is a parameter and each row is a time point. |

`round_EM`