statsmodels.genmod.generalized_linear_model.GLMResults.get_distribution#

GLMResults.get_distribution(exog=None, exposure=None, offset=None, var_weights=1.0, n_trials=1.0)[source]#

Return an instance of the predictive distribution

Parameters:
exogarray_like, optional

The predictor variable matrix.

offsetarray_like, optional

Offset variable for predicted mean.

exposurearray_like, optional

Log(exposure) will be added to the linear prediction.

var_weightsarray_like, optional

1d array of variance (analytic) weights. The default is 1.

n_trialsint, optional

Number of trials for the binomial distribution. The default is 1 which corresponds to a Bernoulli random variable.

Returns:
gen

Instance of a scipy frozen distribution based on estimated parameters. Use the rvs method to generate random values.

Notes

Due to the behavior of scipy.stats.distributions objects, the returned random number generator must be called with gen.rvs(n) where n is the number of observations in the data set used to fit the model. If any other value is used for n, misleading results will be produced.