nemos.observation_models.GammaObservations.estimate_scale#
- GammaObservations.estimate_scale(y, predicted_rate, dof_resid)[source]#
Estimate the scale of the model based on the GLM residuals.
For \(y \sim \Gamma\) the scale is equal to,
\[\Phi = \frac{\text{Var(y)}}{V(\mu)}\]with \(V(\mu) = \mu^2\).
Therefore, the scale can be estimated as the ratio of the sample variance to the squared rate.
- Parameters:
y (
Array
) – Observed neural activity.predicted_rate (
Array
) – The predicted rate values. This is not used in the Poisson model for estimating scale, but is retained for compatibility with the abstract method signature.dof_resid (
Union
[float
,Array
]) – The DOF of the residuals.
- Return type:
Union
[float
,Array
]- Returns:
The scale parameter. If predicted_rate is
(n_samples, n_neurons)
, this method will return a scale for each neuron.