B
    Z                 @   s  d dl mZ d dlZd dlmZ dddZedkred d d d d ddddddgZ	ed d d d d ddddddgZ
eee
Zeee	dddf ed	 e
dddf ed gZd
gdd ed	D  dd edD  Zeee\ZZeej dS )    )print_functionN)np_matrix_rankc             C   s   t | tjr| jdkr| j} t| }t| d }|sDt| d j}tj||f|d}d}d}g }g }	g }
xXt	| |D ]J\}}||dd|f< t
|}||kr|| |}|d7 }qv|	| qvW |ddd|f |fS )z
    construct array with independent columns

    x is either iterable (list, tuple) or instance of ndarray or a subclass of it.
    If x is an ndarray, then each column is assumed to represent a variable with
    observations in rows.
       r   )dtypeN   )
isinstancenpZndarrayndimTlenZasarrayr   Zzeroszipr   append)xvarnamesr   Z
nvars_origZnobsZxoutcountZrank_oldZvarnames_newZvarnames_droppedZkeepindxZxiZniZrank_new r   7lib/python3.7/site-packages/statsmodels/tools/catadd.py	add_indep   s*    


r   __main__r   r      Zconstc             C   s   g | ]}d | qS )zvar1_%dr   ).0ir   r   r   
<listcomp>1   s    r   c             C   s   g | ]}d | qS )zvar2_%dr   )r   r   r   r   r   r   2   s    )N)Z
__future__r   Znumpyr   Zstatsmodels.compat.numpyr   r   __name__ZarrayZx1Zx2Zonesr   Zx0Zcolumn_stackZaranger   r   ZxoZvoprintshaper   r   r   r   <module>   s   
&
  <.