WLS.whiten()

statsmodels.regression.linear_model.WLS.whiten WLS.whiten(X) [source] Whitener for WLS model, multiplies each column by sqrt(self.weights) Parameters: X : array-like Data to be whitened Returns: sqrt(weights)*X :

WLS.score()

statsmodels.regression.linear_model.WLS.score WLS.score(params) Score vector of model. The gradient of logL with respect to each parameter.

WLS.predict()

statsmodels.regression.linear_model.WLS.predict WLS.predict(params, exog=None) Return linear predicted values from a design matrix. Parameters: params : array-like Parameters of a linear model exog : array-like, optional. Design / exogenous data. Model exog is used if None. Returns: An array of fitted values : Notes If the model has not yet been fit, params is not optional.

WLS.loglike()

statsmodels.regression.linear_model.WLS.loglike WLS.loglike(params) [source] Returns the value of the gaussian log-likelihood function at params. Given the whitened design matrix, the log-likelihood is evaluated at the parameter vector params for the dependent variable Y. Parameters: params : array-like The parameter estimates. Returns: llf : float The value of the log-likelihood function for a WLS Model. Notes where is a diagonal matrix

WLS.information()

statsmodels.regression.linear_model.WLS.information WLS.information(params) Fisher information matrix of model Returns -Hessian of loglike evaluated at params.

WLS.initialize()

statsmodels.regression.linear_model.WLS.initialize WLS.initialize()

WLS.hessian()

statsmodels.regression.linear_model.WLS.hessian WLS.hessian(params) The Hessian matrix of the model

WLS.from_formula()

statsmodels.regression.linear_model.WLS.from_formula classmethod WLS.from_formula(formula, data, subset=None, *args, **kwargs) Create a Model from a formula and dataframe. Parameters: formula : str or generic Formula object The formula specifying the model data : array-like The data for the model. See Notes. subset : array-like An array-like object of booleans, integers, or index values that indicate the subset of df to use in the model. Assumes df is a pandas.DataFrame args : extra a

WLS.fit_regularized()

statsmodels.regression.linear_model.WLS.fit_regularized WLS.fit_regularized(method='coord_descent', maxiter=1000, alpha=0.0, L1_wt=1.0, start_params=None, cnvrg_tol=1e-08, zero_tol=1e-08, **kwargs) Return a regularized fit to a linear regression model. Parameters: method : string Only the coordinate descent algorithm is implemented. maxiter : integer The maximum number of iteration cycles (an iteration cycle involves running coordinate descent on all variables). alpha : scalar or array-

Weighted Least Squares

Weighted Least Squares Link to Notebook GitHub In [1]: from __future__ import print_function import numpy as np from scipy import stats import statsmodels.api as sm import matplotlib.pyplot as plt from statsmodels.sandbox.regression.predstd import wls_prediction_std from statsmodels.iolib.table import (SimpleTable, default_txt_fmt) np.random.seed(1024) WLS Estimation Artificial data: Heteroscedasticity 2 groups Model assumptions: Misspecification: true model is quadratic, estimat