models.DoubleGlmFit
A fitted double GLM, from DoubleGlm.fit.
Usage
models.DoubleGlmFit()Attributes
| Name | Description |
|---|---|
| coefficients | The mean’s coefficients. |
| covariance | The mean’s coefficients’ covariance, a list of rows. |
| dispersion_coefficients | The log dispersion’s coefficients. |
| dispersion_covariance | The dispersion’s coefficients’ covariance, a list of rows. |
| dispersion_fitted | The fitted dispersion of each row. |
| dispersion_names | The dispersion design’s column names. |
| fitted | The fitted mean of each row. |
| minus_two_log_likelihood |
dglm’s m2loglik.
|
| names | The mean design’s column names. |
| reml_criterion |
m2loglik + log det(X' W X), the criterion REML minimizes.
|
coefficients
The mean’s coefficients.
coefficients: list[float]
covariance
The mean’s coefficients’ covariance, a list of rows.
covariance: list[list[float]]
dispersion_coefficients
The log dispersion’s coefficients.
dispersion_coefficients: list[float]
dispersion_covariance
The dispersion’s coefficients’ covariance, a list of rows.
dispersion_covariance: list[list[float]]
dispersion_fitted
The fitted dispersion of each row.
dispersion_fitted: list[float]
dispersion_names
The dispersion design’s column names.
dispersion_names: list[str]
fitted
The fitted mean of each row.
fitted: list[float]
minus_two_log_likelihood
dglm’s m2loglik.
minus_two_log_likelihood: float
names
The mean design’s column names.
names: list[str]
reml_criterion
m2loglik + log det(X' W X), the criterion REML minimizes.
reml_criterion: float
Methods
| Name | Description |
|---|---|
| from_json() | Reads an artifact written by to_json. |
| predict() | The mean of each row of a new mean design. |
| predict_dispersion() | The dispersion of each row of a new dispersion design. |
| to_json() | The fit as a versioned JSON artifact: the family, link and method, |
from_json()
Reads an artifact written by to_json.
Usage
from_json(text)Parameters
text: str
Returns
DoubleGlmFit
Raises
ValueError- For malformed JSON, another format, a newer format version or inconsistent fields.
predict()
The mean of each row of a new mean design.
Usage
predict(design)predict_dispersion()
The dispersion of each row of a new dispersion design.
Usage
predict_dispersion(design)to_json()
The fit as a versioned JSON artifact: the family, link and method,
Usage
to_json()the mean’s and the dispersion’s names, estimates and covariances, the fitted means and dispersions, and the fit statistics; numbers bit for bit (#978). from_json reads it back; pickle uses the same document.
Returns
str
Examples
>>> import pickle
>>> from prospicio.models import Design, DoubleGlm, DoubleGlmFit
>>> urban = [0.0] * 4 + [1.0] * 4
>>> d = Design([[1.0] * 8, urban], ["(Intercept)", "urban"])
>>> y = [9.0, 11.0, 10.0, 10.5, 4.0, 18.0, 6.0, 15.0]
>>> fit = DoubleGlm("gamma", link="log").fit(d, d, y)
>>> DoubleGlmFit.from_json(fit.to_json()).coefficients == fit.coefficientsTrue
>>> pickle.loads(pickle.dumps(fit)).dispersion_coefficients == fit.dispersion_coefficientsTrue