statsmodels.regression.linear_model.OLSResults

class statsmodels.regression.linear_model.OLSResults(model, params, normalized_cov_params=None, scale=1.0, cov_type='nonrobust', cov_kwds=None, use_t=None, **kwargs)[source]

Results class for for an OLS model.

Parameters
modelRegressionModel

The regression model instance.

paramsndarray

The estimated parameters.

normalized_cov_paramsndarray

The normalized covariance parameters.

scalefloat

The estimated scale of the residuals.

cov_typestr

The covariance estimator used in the results.

cov_kwdsdict

Additional keywords used in the covariance specification.

use_tbool

Flag indicating to use the Student’s t in inference.

**kwargs

Additional keyword arguments used to initialize the results.

See also

RegressionResults

Results store for WLS and GLW models.

Notes

Most of the methods and attributes are inherited from RegressionResults. The special methods that are only available for OLS are:

  • get_influence

  • outlier_test

  • el_test

  • conf_int_el

Attributes
HC0_se

White’s (1980) heteroskedasticity robust standard errors.

Defined as sqrt(diag(X.T X)^(-1)X.T diag(e_i^(2)) X(X.T X)^(-1) where e_i = resid[i].

When HC0_se or cov_HC0 is called the RegressionResults instance will then have another attribute het_scale, which is in this case is just resid**2.

HC1_se

MacKinnon and White’s (1985) heteroskedasticity robust standard errors.

Defined as sqrt(diag(n/(n-p)*HC_0).

When HC1_se or cov_HC1 is called the RegressionResults instance will then have another attribute het_scale, which is in this case is n/(n-p)*resid**2.

HC2_se

MacKinnon and White’s (1985) heteroskedasticity robust standard errors.

Defined as (X.T X)^(-1)X.T diag(e_i^(2)/(1-h_ii)) X(X.T X)^(-1) where h_ii = x_i(X.T X)^(-1)x_i.T

When HC2_se or cov_HC2 is called the RegressionResults instance will then have another attribute het_scale, which is in this case is resid^(2)/(1-h_ii).

HC3_se

MacKinnon and White’s (1985) heteroskedasticity robust standard errors.

Defined as (X.T X)^(-1)X.T diag(e_i^(2)/(1-h_ii)^(2)) X(X.T X)^(-1) where h_ii = x_i(X.T X)^(-1)x_i.T.

When HC3_se or cov_HC3 is called the RegressionResults instance will then have another attribute het_scale, which is in this case is resid^(2)/(1-h_ii)^(2).

aic

Akaike’s information criteria.

For a model with a constant \(-2llf + 2(df\_model + 1)\). For a model without a constant \(-2llf + 2(df\_model)\).

bic

Bayes’ information criteria.

For a model with a constant \(-2llf + \log(n)(df\_model+1)\). For a model without a constant \(-2llf + \log(n)(df\_model)\).

bse

The standard errors of the parameter estimates.

centered_tss

The total (weighted) sum of squares centered about the mean.

condition_number

Return condition number of exogenous matrix.

Calculated as ratio of largest to smallest eigenvalue.

cov_HC0

Heteroscedasticity robust covariance matrix. See HC0_se.

cov_HC1

Heteroscedasticity robust covariance matrix. See HC1_se.

cov_HC2

Heteroscedasticity robust covariance matrix. See HC2_se.

cov_HC3

Heteroscedasticity robust covariance matrix. See HC3_se.

eigenvals

Return eigenvalues sorted in decreasing order.

ess

The explained sum of squares.

If a constant is present, the centered total sum of squares minus the sum of squared residuals. If there is no constant, the uncentered total sum of squares is used.

f_pvalue

The p-value of the F-statistic.

fittedvalues

The predicted values for the original (unwhitened) design.

fvalue

F-statistic of the fully specified model.

Calculated as the mean squared error of the model divided by the mean squared error of the residuals if the nonrobust covariance is used. Otherwise computed using a Wald-like quadratic form that tests whether all coefficients (excluding the constant) are zero.

llf

Log-likelihood of model

mse_model

Mean squared error the model.

The explained sum of squares divided by the model degrees of freedom.

mse_resid

Mean squared error of the residuals.

The sum of squared residuals divided by the residual degrees of freedom.

mse_total

Total mean squared error.

The uncentered total sum of squares divided by the number of observations.

nobs

Number of observations n.

pvalues

The two-tailed p values for the t-stats of the params.

resid

The residuals of the model.

resid_pearson

Residuals, normalized to have unit variance.

array_like

The array wresid normalized by the sqrt of the scale to have unit variance.

rsquared

R-squared of the model.

This is defined here as 1 - ssr/centered_tss if the constant is included in the model and 1 - ssr/uncentered_tss if the constant is omitted.

rsquared_adj

Adjusted R-squared.

This is defined here as 1 - (nobs-1)/df_resid * (1-rsquared) if a constant is included and 1 - nobs/df_resid * (1-rsquared) if no constant is included.

ssr

Sum of squared (whitened) residuals.

tvalues

Return the t-statistic for a given parameter estimate.

uncentered_tss

Uncentered sum of squares.

The sum of the squared values of the (whitened) endogenous response variable.

use_t

Flag indicating to use the Student’s distribution in inference.

wresid

The residuals of the transformed/whitened regressand and regressor(s).

Methods

compare_f_test(restricted)

Use F test to test whether restricted model is correct.

compare_lm_test(restricted[, demean, use_lr])

Use Lagrange Multiplier test to test a set of linear restrictions.

compare_lr_test(restricted[, large_sample])

Likelihood ratio test to test whether restricted model is correct.

conf_int([alpha, cols])

Compute the confidence interval of the fitted parameters.

conf_int_el(param_num[, sig, upper_bound, …])

Compute the confidence interval using Empirical Likelihood.

cov_params([r_matrix, column, scale, cov_p, …])

Compute the variance/covariance matrix.

el_test(b0_vals, param_nums[, …])

Test single or joint hypotheses using Empirical Likelihood.

f_test(r_matrix[, cov_p, scale, invcov])

Compute the F-test for a joint linear hypothesis.

get_influence()

Calculate influence and outlier measures.

get_prediction([exog, transform, weights, …])

Compute prediction results.

get_robustcov_results([cov_type, use_t])

Create new results instance with robust covariance as default.

initialize(model, params, **kwargs)

Initialize (possibly re-initialize) a Results instance.

load(fname)

Load a pickled results instance

normalized_cov_params()

See specific model class docstring

outlier_test([method, alpha, labels, order, …])

Test observations for outliers according to method.

predict([exog, transform])

Call self.model.predict with self.params as the first argument.

remove_data()

Remove data arrays, all nobs arrays from result and model.

save(fname[, remove_data])

Save a pickle of this instance.

scale()

A scale factor for the covariance matrix.

summary([yname, xname, title, alpha])

Summarize the Regression Results.

summary2([yname, xname, title, alpha, …])

Experimental summary function to summarize the regression results.

t_test(r_matrix[, cov_p, scale, use_t])

Compute a t-test for a each linear hypothesis of the form Rb = q.

t_test_pairwise(term_name[, method, alpha, …])

Perform pairwise t_test with multiple testing corrected p-values.

wald_test(r_matrix[, cov_p, scale, invcov, …])

Compute a Wald-test for a joint linear hypothesis.

wald_test_terms([skip_single, …])

Compute a sequence of Wald tests for terms over multiple columns.

Methods

compare_f_test(restricted)

Use F test to test whether restricted model is correct.

compare_lm_test(restricted[, demean, use_lr])

Use Lagrange Multiplier test to test a set of linear restrictions.

compare_lr_test(restricted[, large_sample])

Likelihood ratio test to test whether restricted model is correct.

conf_int([alpha, cols])

Compute the confidence interval of the fitted parameters.

conf_int_el(param_num[, sig, upper_bound, …])

Compute the confidence interval using Empirical Likelihood.

cov_params([r_matrix, column, scale, cov_p, …])

Compute the variance/covariance matrix.

el_test(b0_vals, param_nums[, …])

Test single or joint hypotheses using Empirical Likelihood.

f_test(r_matrix[, cov_p, scale, invcov])

Compute the F-test for a joint linear hypothesis.

get_influence()

Calculate influence and outlier measures.

get_prediction([exog, transform, weights, …])

Compute prediction results.

get_robustcov_results([cov_type, use_t])

Create new results instance with robust covariance as default.

initialize(model, params, **kwargs)

Initialize (possibly re-initialize) a Results instance.

load(fname)

Load a pickled results instance

normalized_cov_params()

See specific model class docstring

outlier_test([method, alpha, labels, order, …])

Test observations for outliers according to method.

predict([exog, transform])

Call self.model.predict with self.params as the first argument.

remove_data()

Remove data arrays, all nobs arrays from result and model.

save(fname[, remove_data])

Save a pickle of this instance.

scale()

A scale factor for the covariance matrix.

summary([yname, xname, title, alpha])

Summarize the Regression Results.

summary2([yname, xname, title, alpha, …])

Experimental summary function to summarize the regression results.

t_test(r_matrix[, cov_p, scale, use_t])

Compute a t-test for a each linear hypothesis of the form Rb = q.

t_test_pairwise(term_name[, method, alpha, …])

Perform pairwise t_test with multiple testing corrected p-values.

wald_test(r_matrix[, cov_p, scale, invcov, …])

Compute a Wald-test for a joint linear hypothesis.

wald_test_terms([skip_single, …])

Compute a sequence of Wald tests for terms over multiple columns.

Properties

HC0_se

White’s (1980) heteroskedasticity robust standard errors.

HC1_se

MacKinnon and White’s (1985) heteroskedasticity robust standard errors.

HC2_se

MacKinnon and White’s (1985) heteroskedasticity robust standard errors.

HC3_se

MacKinnon and White’s (1985) heteroskedasticity robust standard errors.

aic

Akaike’s information criteria.

bic

Bayes’ information criteria.

bse

The standard errors of the parameter estimates.

centered_tss

The total (weighted) sum of squares centered about the mean.

condition_number

Return condition number of exogenous matrix.

cov_HC0

Heteroscedasticity robust covariance matrix.

cov_HC1

Heteroscedasticity robust covariance matrix.

cov_HC2

Heteroscedasticity robust covariance matrix.

cov_HC3

Heteroscedasticity robust covariance matrix.

eigenvals

Return eigenvalues sorted in decreasing order.

ess

The explained sum of squares.

f_pvalue

The p-value of the F-statistic.

fittedvalues

The predicted values for the original (unwhitened) design.

fvalue

F-statistic of the fully specified model.

llf

Log-likelihood of model

mse_model

Mean squared error the model.

mse_resid

Mean squared error of the residuals.

mse_total

Total mean squared error.

nobs

Number of observations n.

pvalues

The two-tailed p values for the t-stats of the params.

resid

The residuals of the model.

resid_pearson

Residuals, normalized to have unit variance.

rsquared

R-squared of the model.

rsquared_adj

Adjusted R-squared.

ssr

Sum of squared (whitened) residuals.

tvalues

Return the t-statistic for a given parameter estimate.

uncentered_tss

Uncentered sum of squares.

use_t

Flag indicating to use the Student’s distribution in inference.

wresid

The residuals of the transformed/whitened regressand and regressor(s).