InvGaussDist#
- class pygam.distributions.InvGaussDist(scale=None)[source]#
Bases:
DistributionInverse Gaussian (Wald) Distribution
- Parameters:
- scalefloat or None, default: None
scale/standard deviation of the distribution
Methods
V(mu)Glm Variance function.
deviance(y, mu[, scaled])Model deviance.
get_params([deep])Returns a dict of all of the object's user-facing parameters.
log_pdf(y, mu[, weights])Computes the log of the pdf or pmf of the values under the current distribution.
phi(y, mu, edof, weights)Related to GLM scale parameter.
sample(mu)Return random samples from this Inverse Gaussian (Wald) distribution.
set_params([deep, force])Sets an object's parameters.
- V(mu)[source]#
Glm Variance function.
computes the variance of the distribution
- Parameters:
- muarray-like of length n
expected values
- Returns:
- variancenp.array of length n
- deviance(y, mu, scaled=True)[source]#
Model deviance.
for a bernoulli logistic model, this is equal to the twice the negative loglikelihod.
- Parameters:
- yarray-like of length n
target values
- muarray-like of length n
expected values
- scaledboolean, default: True
whether to divide the deviance by the distribution scaled
- Returns:
- deviancesnp.array of length n
- get_params(deep=False)[source]#
Returns a dict of all of the object’s user-facing parameters.
- Parameters:
- deepboolean, default: False
when True, also gets non-user-facing parameters
- Returns:
- dict
- log_pdf(y, mu, weights=None)[source]#
Computes the log of the pdf or pmf of the values under the current distribution.
- Parameters:
- yarray-like of length n
target values
- muarray-like of length n
expected values
- weightsarray-like shape (n,) or None, default: None
containing sample weights if None, defaults to array of ones
- Returns:
- pdf/pmfnp.array of length n
- phi(y, mu, edof, weights)[source]#
Related to GLM scale parameter. for Binomial and Poisson families this is unity for Normal family this is variance.
- Parameters:
- yarray-like of length n
target values
- muarray-like of length n
expected values
- edoffloat
estimated degrees of freedom
- weightsarray-like shape (n,) or None, default: None
sample weights if None, defaults to array of ones
- Returns:
- scaleestimated model scale
- sample(mu)[source]#
Return random samples from this Inverse Gaussian (Wald) distribution.
- Parameters:
- muarray-like of shape n_samples or shape (n_simulations, n_samples)
expected values
- Returns:
- random_samplesnp.array of same shape as mu
- set_params(deep=False, force=False, **parameters)[source]#
Sets an object’s parameters.
- Parameters:
- deepboolean, default: False
when True, also sets non-user-facing parameters
- forceboolean, default: False
when True, also sets parameters that the object does not already have
- **parametersparameters to set
- Returns:
- self