statsmodels.regression.linear_model.OLS.get_distribution¶
- OLS.get_distribution(params, scale, exog=None, dist_class=None)¶
Construct a random number generator for the predictive distribution.
- Parameters:¶
- paramsarray_like
The model parameters (regression coefficients).
- scalescalar
The variance parameter.
- exogarray_like
The predictor variable matrix.
- dist_class
class A random number generator class. Must take ‘loc’ and ‘scale’ as arguments and return a random number generator implementing an
rvsmethod for simulating random values. Defaults to normal.
- Returns:¶
genFrozen random number generator object with mean and variance determined by the fitted linear model. Use the
rvsmethod to generate random values.
Notes
Due to the behavior of
scipy.stats.distributions objects, the returned random number generator must be called withgen.rvs(n)wherenis the number of observations in the data set used to fit the model. If any other value is used forn, misleading results will be produced.