# squidpy.gr.ripley

squidpy.gr.ripley(adata, cluster_key, mode='F', spatial_key='spatial', metric='euclidean', n_neigh=2, n_simulations=100, n_observations=1000, max_dist=None, n_steps=50, seed=None, copy=False)[source]

Calculate various Ripley’s statistics for point processes.

According to the ‘mode’ argument, it calculates one of the following Ripley’s statistics: ‘F’, ‘G’ or ‘L’ statistics.

‘F’, ‘G’ are defined as:

$F(t),G(t)=P( d_{i,j} \le t )$

Where $$d_{i,j}$$ represents:

• distances to a random Spatial Poisson Point Process for ‘F’.

• distances to any other point of the dataset for ‘G’.

‘L’ we first need to compute $$K(t)$$, which is defined as:

$K(t) = \frac{1}{\lambda} \sum_{i \ne j} \frac{I(d_{i,j}<t)}{n}$

and then we apply a variance-stabilizing transformation:

$L(t) = (\frac{K(t)}{\pi})^{1/2}$
Parameters
Return type
Returns

If copy = True, returns a dict with following keys:

Otherwise, modifies the adata object with the following key:

Statistics and p-values are computed for each cluster anndata.AnnData.obs ['{cluster_key}'] separately.

References

For reference, check out Wikipedia or .