algorithms.statistics.models.family.family¶
Module: algorithms.statistics.models.family.family
¶
Inheritance diagram for nipy.algorithms.statistics.models.family.family
:
Classes¶
Binomial
¶
-
class
nipy.algorithms.statistics.models.family.family.
Binomial
(link=<nipy.algorithms.statistics.models.family.links.Logit object>, n=1)[source]¶ Bases:
nipy.algorithms.statistics.models.family.family.Family
Binomial exponential family.
- INPUTS:
link – a Link instance n – number of trials for Binomial
-
__init__
(link=<nipy.algorithms.statistics.models.family.links.Logit object>, n=1)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
links
= [<nipy.algorithms.statistics.models.family.links.Logit object>, <nipy.algorithms.statistics.models.family.links.CDFLink object>, <nipy.algorithms.statistics.models.family.links.CDFLink object>, <nipy.algorithms.statistics.models.family.links.Log object>, <nipy.algorithms.statistics.models.family.links.CLogLog object>]¶
-
variance
= <nipy.algorithms.statistics.models.family.varfuncs.Binomial object>¶
-
property
link
¶
-
devresid
(Y, mu)[source]¶ Binomial deviance residual
- INPUTS:
Y – response variable mu – mean parameter
- OUTPUTS: resid
resid – 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 aboce
-
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
Family
¶
-
class
nipy.algorithms.statistics.models.family.family.
Family
(link, variance)[source]¶ 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)
-
valid
= [-inf, inf]¶
-
tol
= 1e-05¶
-
links
= []¶
-
property
link
¶
-
weights
(mu)[source]¶ 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
-
deviance
(Y, mu, scale=1.0)[source]¶ 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 aboce
-
devresid
(Y, mu)[source]¶ 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
Gamma
¶
-
class
nipy.algorithms.statistics.models.family.family.
Gamma
(link=<nipy.algorithms.statistics.models.family.links.Power object>)[source]¶ Bases:
nipy.algorithms.statistics.models.family.family.Family
Gamma exponential family.
- INPUTS:
link – a Link instance
- BUGS:
no deviance residuals?
-
__init__
(link=<nipy.algorithms.statistics.models.family.links.Power object>)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
links
= [<nipy.algorithms.statistics.models.family.links.Log object>, <nipy.algorithms.statistics.models.family.links.Power object>, <nipy.algorithms.statistics.models.family.links.Power object>]¶
-
variance
= <nipy.algorithms.statistics.models.family.varfuncs.Power object>¶
-
property
link
¶
-
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 aboce
-
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
Gaussian
¶
-
class
nipy.algorithms.statistics.models.family.family.
Gaussian
(link=<nipy.algorithms.statistics.models.family.links.Power object>)[source]¶ Bases:
nipy.algorithms.statistics.models.family.family.Family
Gaussian exponential family.
- INPUTS:
link – a Link instance
-
__init__
(link=<nipy.algorithms.statistics.models.family.links.Power object>)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
links
= [<nipy.algorithms.statistics.models.family.links.Log object>, <nipy.algorithms.statistics.models.family.links.Power object>, <nipy.algorithms.statistics.models.family.links.Power object>]¶
-
variance
= <nipy.algorithms.statistics.models.family.varfuncs.VarianceFunction object>¶
-
property
link
¶
-
devresid
(Y, mu, scale=1.0)[source]¶ Gaussian deviance residual
- INPUTS:
Y – response variable mu – mean parameter scale – optional scale in denominator (after taking sqrt)
- OUTPUTS: resid
resid – 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 aboce
-
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
InverseGaussian
¶
-
class
nipy.algorithms.statistics.models.family.family.
InverseGaussian
(link=<nipy.algorithms.statistics.models.family.links.Power object>)[source]¶ Bases:
nipy.algorithms.statistics.models.family.family.Family
InverseGaussian exponential family.
- INPUTS:
link – a Link instance n – number of trials for Binomial
-
__init__
(link=<nipy.algorithms.statistics.models.family.links.Power object>)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
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 aboce
-
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
-
links
= [<nipy.algorithms.statistics.models.family.links.Power object>, <nipy.algorithms.statistics.models.family.links.Power object>, <nipy.algorithms.statistics.models.family.links.Power object>, <nipy.algorithms.statistics.models.family.links.Log object>]¶
-
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
-
variance
= <nipy.algorithms.statistics.models.family.varfuncs.Power object>¶
-
property
link
¶
Poisson
¶
-
class
nipy.algorithms.statistics.models.family.family.
Poisson
(link=<nipy.algorithms.statistics.models.family.links.Log object>)[source]¶ Bases:
nipy.algorithms.statistics.models.family.family.Family
Poisson exponential family.
- INPUTS:
link – a Link instance
-
__init__
(link=<nipy.algorithms.statistics.models.family.links.Log object>)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
links
= [<nipy.algorithms.statistics.models.family.links.Log object>, <nipy.algorithms.statistics.models.family.links.Power object>, <nipy.algorithms.statistics.models.family.links.Power object>]¶
-
valid
= [0, inf]¶
-
variance
= <nipy.algorithms.statistics.models.family.varfuncs.Power object>¶
-
property
link
¶
-
devresid
(Y, mu)[source]¶ Poisson deviance residual
- INPUTS:
Y – response variable mu – mean parameter
- OUTPUTS: resid
resid – 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 aboce
-
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¶
-
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