
    M/Ph
                     Z    d Z ddlmZ ddlZddlmZ ddlmZ ddl	m
Z
 ddlmc mZ d ZdS )zTest for panel robust covariance estimators after pooled ols
this follows the example from xtscc paper/help

Created on Tue May 22 20:27:57 2012

Author: Josef Perktold
    )lmapN)assert_almost_equal)OLS)add_constantc                  ^   dd l mc m}  ddlm} | j                                        }|j        d d         }|j        d d         }t          |t          |ddg         d                                                    }t          j        |d	g         d
          }||                                z  }t          j        |                              t"                    }d t%          d          D             }t          j        t          j        |dg         d          d          \  }}	t+          j        |d|d          }
t/          |
|j        d           t+          j        |d|d          }
t/          |
|j        d           t+          j        |d|          }
t/          |
|j        d           t+          j        ||	          }t/          ||j        d           t+          j        |t;          t<          |	                    }t/          ||j        d           t+          j        |d|d          }t/          ||j         d           t+          j        |d|d          }t/          ||j!        d           t+          j        |d|          }t/          ||j"        d           d S )Nr      )results   valuecapitalF)prependyearW)requirementsc                 (    g | ]}|d z  d |dz   z  fS )   r    ).0is     l/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/statsmodels/stats/tests/test_panel_robustcov.py
<listcomp>z)test_panel_robust_cov.<locals>.<listcomp>#   s)    000QrT2qs8000    
   firmS20T)return_inversehac)use_correction   )decimal)#statsmodels.datasets.grunfelddatasetsgrunfeldresults.results_panelrobustr	   dataload_pandasendogexogr   r   fitnprequireminsqueezeastypeintrangeuniqueasarrayswcov_nw_panelr   cov_pnw0_statacov_pnw1_statacov_pnw4_statacov_clustercov_clu_statar   strcov_nw_groupsumcov_dk0_statacov_dk1_statacov_dk4_stata)gr	res_statadtapadtapa_endog
dtapa_exogrestimetidx
firm_namesfirm_idcovcov_clurcovs                r   test_panel_robust_covrL      s   .........AAAAAAG!!E+dsd#KDSD!J
k<
GY3G(H    !cee  :j&*===DDHHJJD:d""3''D 10eBii000D )BJz6(/CU$K$K379 9 9J /#q$u
=
=
=C Y5qAAAA
/#q$u
=
=
=CY5qAAAA
/#q$
'
'CY5qAAAA nS'**G!8!DDDD nS$sG"4"455G!8!DDDD c1d1===Di5qAAAAc1d1===Di5qAAAAc1d++Di5qAAAAAAr   )__doc__statsmodels.compat.pythonr   numpyr*   numpy.testingr   #statsmodels.regression.linear_modelr   statsmodels.tools.toolsr   %statsmodels.stats.sandwich_covariancestatssandwich_covariancer3   rL   r   r   r   <module>rV      s     + * * * * *     - - - - - - 3 3 3 3 3 3 0 0 0 0 0 0 2 2 2 2 2 2 2 2 25B 5B 5B 5B 5Br   