# algorithms.statistics.models.family.family¶

## Module: `algorithms.statistics.models.family.family`¶

Inheritance diagram for `nipy.algorithms.statistics.models.family.family`:

## Classes¶

### `Binomial`¶

Bases: `Family`

Binomial exponential family.

INPUTS:

link – a Link instance n – number of trials for Binomial

deviance(Y, mu, scale=1.0)

Deviance of (Y,mu) pair. Deviance is usually defined as the difference

DEV = (SUM_i -2 log Likelihood(Y_i,mu_i) + 2 log Likelihood(mu_i,mu_i)) / scale

INPUTS:

Y – response variable mu – mean parameter scale – optional scale in denominator of deviance

OUTPUTS: dev

dev – DEV, as described above

devresid(Y, mu)

Binomial deviance residual

INPUTS:

Y – response variable mu – mean parameter

OUTPUTS: resid

resid – deviance residuals

fitted(eta)

Fitted values based on linear predictors eta.

INPUTS:
eta – values of linear predictors, say,

X beta in a generalized linear model.

OUTPUTS: mu

mu – link.inverse(eta), mean parameter based on eta

predict(mu)

Linear predictors based on given mu values.

INPUTS:

mu – mean parameter of one-parameter exponential family

OUTPUTS: eta
eta – link(mu), linear predictors, based on

mean parameters mu

tol = 1e-05
valid = [-inf, inf]
variance = <nipy.algorithms.statistics.models.family.varfuncs.Binomial object>
weights(mu)

Weights for IRLS step.

w = 1 / (link’(mu)**2 * variance(mu))

INPUTS:

mu – mean parameter in exponential family

OUTPUTS:

w – weights used in WLS step of GLM/GAM fit

### `Family`¶

Bases: `object`

A class to model one-parameter exponential families.

INPUTS:

link – a Link instance variance – a variance function (models means as a function

of mean)

deviance(Y, mu, scale=1.0)

Deviance of (Y,mu) pair. Deviance is usually defined as the difference

DEV = (SUM_i -2 log Likelihood(Y_i,mu_i) + 2 log Likelihood(mu_i,mu_i)) / scale

INPUTS:

Y – response variable mu – mean parameter scale – optional scale in denominator of deviance

OUTPUTS: dev

dev – DEV, as described above

devresid(Y, mu)

The deviance residuals, defined as the residuals in the deviance.

Without knowing the link, they default to Pearson residuals

resid_P = (Y - mu) * sqrt(weight(mu))

INPUTS:

Y – response variable mu – mean parameter

OUTPUTS: resid

resid – deviance residuals

fitted(eta)

Fitted values based on linear predictors eta.

INPUTS:
eta – values of linear predictors, say,

X beta in a generalized linear model.

OUTPUTS: mu

mu – link.inverse(eta), mean parameter based on eta

predict(mu)

Linear predictors based on given mu values.

INPUTS:

mu – mean parameter of one-parameter exponential family

OUTPUTS: eta
eta – link(mu), linear predictors, based on

mean parameters mu

tol = 1e-05
valid = [-inf, inf]
weights(mu)

Weights for IRLS step.

w = 1 / (link’(mu)**2 * variance(mu))

INPUTS:

mu – mean parameter in exponential family

OUTPUTS:

w – weights used in WLS step of GLM/GAM fit

### `Gamma`¶

Bases: `Family`

Gamma exponential family.

INPUTS:

BUGS:

no deviance residuals?

deviance(Y, mu, scale=1.0)

Deviance of (Y,mu) pair. Deviance is usually defined as the difference

DEV = (SUM_i -2 log Likelihood(Y_i,mu_i) + 2 log Likelihood(mu_i,mu_i)) / scale

INPUTS:

Y – response variable mu – mean parameter scale – optional scale in denominator of deviance

OUTPUTS: dev

dev – DEV, as described above

devresid(Y, mu)

The deviance residuals, defined as the residuals in the deviance.

Without knowing the link, they default to Pearson residuals

resid_P = (Y - mu) * sqrt(weight(mu))

INPUTS:

Y – response variable mu – mean parameter

OUTPUTS: resid

resid – deviance residuals

fitted(eta)

Fitted values based on linear predictors eta.

INPUTS:
eta – values of linear predictors, say,

X beta in a generalized linear model.

OUTPUTS: mu

mu – link.inverse(eta), mean parameter based on eta

predict(mu)

Linear predictors based on given mu values.

INPUTS:

mu – mean parameter of one-parameter exponential family

OUTPUTS: eta
eta – link(mu), linear predictors, based on

mean parameters mu

tol = 1e-05
valid = [-inf, inf]
variance = <nipy.algorithms.statistics.models.family.varfuncs.Power object>
weights(mu)

Weights for IRLS step.

w = 1 / (link’(mu)**2 * variance(mu))

INPUTS:

mu – mean parameter in exponential family

OUTPUTS:

w – weights used in WLS step of GLM/GAM fit

### `Gaussian`¶

Bases: `Family`

Gaussian exponential family.

INPUTS:

deviance(Y, mu, scale=1.0)

Deviance of (Y,mu) pair. Deviance is usually defined as the difference

DEV = (SUM_i -2 log Likelihood(Y_i,mu_i) + 2 log Likelihood(mu_i,mu_i)) / scale

INPUTS:

Y – response variable mu – mean parameter scale – optional scale in denominator of deviance

OUTPUTS: dev

dev – DEV, as described above

devresid(Y, mu, scale=1.0)

Gaussian deviance residual

INPUTS:

Y – response variable mu – mean parameter scale – optional scale in denominator (after taking sqrt)

OUTPUTS: resid

resid – deviance residuals

fitted(eta)

Fitted values based on linear predictors eta.

INPUTS:
eta – values of linear predictors, say,

X beta in a generalized linear model.

OUTPUTS: mu

mu – link.inverse(eta), mean parameter based on eta

predict(mu)

Linear predictors based on given mu values.

INPUTS:

mu – mean parameter of one-parameter exponential family

OUTPUTS: eta
eta – link(mu), linear predictors, based on

mean parameters mu

tol = 1e-05
valid = [-inf, inf]
variance = <nipy.algorithms.statistics.models.family.varfuncs.VarianceFunction object>
weights(mu)

Weights for IRLS step.

w = 1 / (link’(mu)**2 * variance(mu))

INPUTS:

mu – mean parameter in exponential family

OUTPUTS:

w – weights used in WLS step of GLM/GAM fit

### `InverseGaussian`¶

Bases: `Family`

InverseGaussian exponential family.

INPUTS:

link – a Link instance n – number of trials for Binomial

deviance(Y, mu, scale=1.0)

Deviance of (Y,mu) pair. Deviance is usually defined as the difference

DEV = (SUM_i -2 log Likelihood(Y_i,mu_i) + 2 log Likelihood(mu_i,mu_i)) / scale

INPUTS:

Y – response variable mu – mean parameter scale – optional scale in denominator of deviance

OUTPUTS: dev

dev – DEV, as described above

devresid(Y, mu)

The deviance residuals, defined as the residuals in the deviance.

Without knowing the link, they default to Pearson residuals

resid_P = (Y - mu) * sqrt(weight(mu))

INPUTS:

Y – response variable mu – mean parameter

OUTPUTS: resid

resid – deviance residuals

fitted(eta)

Fitted values based on linear predictors eta.

INPUTS:
eta – values of linear predictors, say,

X beta in a generalized linear model.

OUTPUTS: mu

mu – link.inverse(eta), mean parameter based on eta

predict(mu)

Linear predictors based on given mu values.

INPUTS:

mu – mean parameter of one-parameter exponential family

OUTPUTS: eta
eta – link(mu), linear predictors, based on

mean parameters mu

tol = 1e-05
valid = [-inf, inf]
variance = <nipy.algorithms.statistics.models.family.varfuncs.Power object>
weights(mu)

Weights for IRLS step.

w = 1 / (link’(mu)**2 * variance(mu))

INPUTS:

mu – mean parameter in exponential family

OUTPUTS:

w – weights used in WLS step of GLM/GAM fit

### `Poisson`¶

Bases: `Family`

Poisson exponential family.

INPUTS:

deviance(Y, mu, scale=1.0)

Deviance of (Y,mu) pair. Deviance is usually defined as the difference

DEV = (SUM_i -2 log Likelihood(Y_i,mu_i) + 2 log Likelihood(mu_i,mu_i)) / scale

INPUTS:

Y – response variable mu – mean parameter scale – optional scale in denominator of deviance

OUTPUTS: dev

dev – DEV, as described above

devresid(Y, mu)

Poisson deviance residual

INPUTS:

Y – response variable mu – mean parameter

OUTPUTS: resid

resid – deviance residuals

fitted(eta)

Fitted values based on linear predictors eta.

INPUTS:
eta – values of linear predictors, say,

X beta in a generalized linear model.

OUTPUTS: mu

mu – link.inverse(eta), mean parameter based on eta

predict(mu)

Linear predictors based on given mu values.

INPUTS:

mu – mean parameter of one-parameter exponential family

OUTPUTS: eta
eta – link(mu), linear predictors, based on

mean parameters mu

tol = 1e-05
valid = [0, inf]
variance = <nipy.algorithms.statistics.models.family.varfuncs.Power object>
weights(mu)

Weights for IRLS step.

w = 1 / (link’(mu)**2 * variance(mu))

INPUTS:

mu – mean parameter in exponential family

OUTPUTS:

w – weights used in WLS step of GLM/GAM fit