Runs EM algorithm to compute MLE for the locally IID model of Cao et al. (2000). Uses numerical optimization of Q-function for each M-step with analytic computation of its gradient.

1 2 | ```
locally_iid_EM(Y, A, lambda0, phi0 = NULL, c = 2, maxiter = 1000,
tol = 1e-06, epsilon = 0.01, method = "L-BFGS-B", checkActive = FALSE)
``` |

`Y` |
matrix (h x k) of observations in local window; columns correspond to OD flows, and rows are individual observations |

`A` |
routing matrix (m x k) for network being analyzed |

`lambda0` |
initial vector of values (length k) for
lambda; |

`phi0` |
initial value for covariance scale phi;
initializes automatically using |

`c` |
power parameter in model of Cao et al. (2000) |

`maxiter` |
maximum number of EM iterations to run |

`tol` |
tolerance (in relative change in Q function value) for stopping EM iterations |

`epsilon` |
numeric nugget to add to diagonal of covariance for numerical stability |

`method` |
optimization method to use (in optim calls) |

`checkActive` |
logical check for deterministically known OD flows |

list with 3 elements: `lambda`

, the estimated value of
lambda; `phi`

, the estimated value of phi; and
`iter`

, the number of iterations run

J. Cao, D. Davis, S. Van Der Viel, and B. Yu. Time-varying network tomography: router link data. Journal of the American Statistical Association, 95:1063-75, 2000.

Other CaoEtAl: `Q_iid`

;
`Q_smoothed`

; `R_estep`

;
`grad_iid`

; `grad_smoothed`

;
`m_estep`

; `phi_init`

;
`smoothed_EM`

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

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