# Two sample K-S test as an alternative to maximum likelihood

I have a model with 3 parameters that I would like to fit to my (unidimensional iid) data. The model is a Hidden Markov Model and therefore it is intrinsically probabilistic. It is fairly straightforward to simulate samples from it. However, given the functional form of the transition and emission probabilities, it is very troublesome to obtain the likelihood function.

So I was thinking, what if I simulate $n$ iid samples $\mathbf{y}={y_1,y_2,...,y_n}$ from the model and then compare it with my sequence of $m$ iid observations $\mathbf{x}={x_1,x_2,...,x_m}$ with a two sample K-S test to check if they are drawn from the same distribution? Then I could find the set of parameters that minimize the $D_{nm}$ statistic coming from the K-S test.

How does this compare to maximum likelihood? Would this method have any clear disadvantages? Is there a preferred size $n$ of the simulated samples that would optimize the method according to $m$?

• I am curious how you would go about finding those parameters, since your objective function isn't differentiable and can be computed only approximately. I suspect the solution would (in general) be a large set of parameters even if you could compute the objective function exactly. – whuber Aug 24 '16 at 14:20
• Assuming $D$ would be concave, I would create a grid for the parameters and iterate over it until I find the minimum, or use something more sophisticated like fminsearch in matlab. – J. R. C. Aug 24 '16 at 14:29
• Your computational requirements will be enormous, because simulation will only approximate the distribution poorly unless $n$ is huge. – whuber Aug 24 '16 at 14:43
• Do you think that a particle filter (sequential MC) approach is generally more adequate? (In line with what @Alf suggested) – J. R. C. Aug 24 '16 at 16:18

## 1 Answer

To a certain extent, and more informally, your proposal is related to the Approximate Bayesian Computation (ABC) approach in which you simulate from your model and check whether or not it is similar to your original data. In your case, you are comparing the two samples using the KS test, and the performance of this approach depends on the tunning parameters (significance level, sample size, and etcetera). The following reference discusses different approaches to estimate the parameters in hidden Markov models, which are related to ABC:

Dean, Thomas A., et al. "Parameter estimation for hidden Markov models with intractable likelihoods." Scandinavian Journal of Statistics 41.4 (2014): 970-987.