and
with is the 0-th order modified Bessel function of first kind. Given the samples we want to find the parameters of this model (). Expectation-Maximization (EM) algorithm can be used to estimate the model parameters . Following algorithm shows the steps of the EM for fitting the Rayleigh-Rice model.
Given the fitted model parameters the threshold value is found by solving the following for .
A sample histogram of for all is shown in figure. The plotted curves show the fitted Rayleigh and Rice distributions. In this example, the values of denote the standard deviation of electrode activity and the fitted model separates the active and inactive electrodes.
The matlab implementation is provided here.