class_docstr: A regression model with an estimated heteroscedasticity.
  
  A subclass of WLS, that additionally estimates the weight matrix as a
  function of additional explanatory variables.
  
  Parameters
  ----------
  endog : array_like
  exog : array_like
  exog_var : array_like, 1d or 2d
      regressors, explanatory variables for the variance
  weights : array_like or None
      If weights are given, then they are used in the first step estimation.
  link : link function or None
      If None, then the variance is assumed to be a linear combination of
      the exog_var. If given, then ...  not tested yet
  
  *extra attributes*
  
  history : dict
     contains the parameter estimates in both regression for each iteration
  
  result instance has
  
  results_residual_regression : OLS result instance
      result of heteroscedasticity estimation
  
  except for fit_iterative all methods are inherited from WLS.
  
  Notes
  -----
  GLSHet is considered to be experimental.
  
  `fit` is just standard WLS fit for fixed weights
  `fit_iterative` updates the estimate for weights, see its docstring
  
  The two alternative for handling heteroscedasticity in the data are to
  use heteroscedasticity robust standard errors or estimating the
  heteroscedasticity
  Estimating heteroscedasticity and using weighted least squares produces
  smaller confidence intervals for the estimated parameters then the
  heteroscedasticity robust standard errors if the heteroscedasticity is
  correctly specified. If the heteroscedasticity is incorrectly specified
  then the estimated covariance is inconsistent.
  
  Stock and Watson for example argue in favor of using OLS with
  heteroscedasticity robust standard errors instead of GLSHet sind we are
  seldom sure enough about the correct specification (in economics).
  
  GLSHet has asymptotically the same distribution as WLS if the true
  weights are know. In both cases the asymptotic distribution of the
  parameter estimates is the normal distribution.
  
  The assumption of the model:
  
  y = X*beta + u,
  with E(u) = 0, E(X*u)=0, var(u_i) = z_i*gamma
  or for vector of all observations Sigma = diag(Z*gamma)
  
  where
  y : endog (nobs)
  X : exog  (nobs, k_vars)
  Z : exog_var (nobs, k_vars2)
  beta, gamma estimated parameters
  
  If a link is specified, then the heteroscedasticity is
  
  var(u_i) = link.inverse(z_i*gamma), or
  link(var(u_i)) = z_i*gamma
  
  for example for log-linkg
  var(u_i) = exp(z_i*gamma)
  
  
  Usage : see example ....
  
  TODO: test link option
class_docstr_tok: ["A","regression","model","with","an","estimated","heteroscedasticity",".","A","subclass","of","WLS",",","that","additionally","estimates","the","weight","matrix","as","a","function","of","additional","explanatory","variables",".","Parameters","--","--","--","--","--","endog",":","array_like","exog",":","array_like","exog_var",":","array_like",",","1d","or","2d","regressors",",","explanatory","variables","for","the","variance","weights",":","array_like","or","None","If","weights","are","given",",","then","they","are","used","in","the","first","step","estimation",".","link",":","link","function","or","None","If","None",",","then","the","variance","is","assumed","to","be","a","linear","combination","of","the","exog_var",".","If","given",",","then","...","not","tested","yet","*","extra","attributes","*","history",":","dict","contains","the","parameter","estimates","in","both","regression","for","each","iteration","result","instance","has","results_residual_regression",":","OLS","result","instance","result","of","heteroscedasticity","estimation","except","for","fit_iterative","all","methods","are","inherited","from","WLS",".","Notes","--","--","-","GLSHet","is","considered","to","be","experimental",".","`","fit","`","is","just","standard","WLS","fit","for","fixed","weights","`","fit_iterative","`","updates","the","estimate","for","weights",",","see","its","docstring","The","two","alternative","for","handling","heteroscedasticity","in","the","data","are","to","use","heteroscedasticity","robust","standard","errors","or","estimating","the","heteroscedasticity","Estimating","heteroscedasticity","and","using","weighted","least","squares","produces","smaller","confidence","intervals","for","the","estimated","parameters","then","the","heteroscedasticity","robust","standard","errors","if","the","heteroscedasticity","is","correctly","specified",".","If","the","heteroscedasticity","is","incorrectly","specified","then","the","estimated","covariance","is","inconsistent",".","Stock","and","Watson","for","example","argue","in","favor","of","using","OLS","with","heteroscedasticity","robust","standard","errors","instead","of","GLSHet","sind","we","are","seldom","sure","enough","about","the","correct","specification","(","in","economics",")",".","GLSHet","has","asymptotically","the","same","distribution","as","WLS","if","the","true","weights","are","know",".","In","both","cases","the","asymptotic","distribution","of","the","parameter","estimates","is","the","normal","distribution",".","The","assumption","of","the","model",":","y","=","X","*","beta","+","u",",","with","E","(","u",")","=","0",",","E","(","X","*","u",")","=0",",","var","(","u_i",")","=","z_i","*","gamma","or","for","vector","of","all","observations","Sigma","=","diag","(","Z","*","gamma",")","where","y",":","endog","(","nobs",")","X",":","exog","(","nobs",",","k_vars",")","Z",":","exog_var","(","nobs",",","k_vars2",")","beta",",","gamma","estimated","parameters","If","a","link","is","specified",",","then","the","heteroscedasticity","is","var","(","u_i",")","=","link.inverse","(","z_i","*","gamma",")",",","or","link","(","var","(","u_i",")",")","=","z_i","*","gamma","for","example","for","log-linkg","var","(","u_i",")","=","exp","(","z_i","*","gamma",")","Usage",":","see","example","....","TODO",":","test","link","option"]
code: def __init__(
      self, endog, exog, exog_var=None, weights=None, link=None
  ):
      self.exog_var = atleast_2dcols(exog_var)
      if weights is None:
          weights = np.ones(endog.shape)
      if link is not None:
          self.link = link
          self.linkinv = link.inverse  # as defined in families.links
      else:
          self.link = lambda x: x  # no transformation
          self.linkinv = lambda x: x
  
      super(self.__class__, self).__init__(endog, exog, weights=weights)
  
file_path: statsmodels/statsmodels/regression/feasible_gls.py
imports: import numpy
  from statsmodels.regression.linear_model import OLS, GLS, WLS
label_desc: Use image node_id 1 to create a new GLSHet object from inherited base classes: WLS with example: obj = GLSHet(endog, exog, exog_var, weights, link)