# PDAF_diag_effsample

This page documents the routine `PDAF_diag_effsample`

of PDAF, which was introduced with PDAF V1.12.

This routine computes the effective sample size of a particle filter as defined in Doucet et al. 2001 p. 333.

The effective sample size is a diagnostic quantity used in particle filter. It is defined as the inverse of the sum of the squared particle filter weights:

n_eff = 1 / (Sum_i=1,N w_i^2)

where `w_i`

is the weight of particle with index i and `N`

is the number of particles. If all weights are identical, it is `n_eff=N`

and a particle file analysis step will have no influence. If `n_eff=1`

, a single particle contains all weight, such that the sample of particle collapeses.

The routine is typically called during the analysis step of a particle filter, e.g. in the analysis step of NETF and LNETF.

The interface is the following:

SUBROUTINE PDAF_diag_effsample(dim_sample, weights, n_eff)

with the following arguments:

`dim_sample`

:`integer, intent(in)`

Number of particles`weights`

:`real, intent(in), dimension(dim_sample)`

Weights of the particles`n_eff`

:`real, intent(out)`

Effective sample size