
    >h                     j    S r SSKrSSKJr  SSKJr  SSKJr  SSKJ	r	  SSKJ
r
Jr  S	r " S
 S\5      rg)z7Multivariate analysis of variance

author: Yichuan Liu
    N)Substitution)Model   )MultivariateTestResults)_multivariate_ols_fit)_multivariate_ols_test_hypotheses_doczrestructuredtext enc                   V   ^  \ rS rSrSrSrS	U 4S jjrS r\" \	S9S
S j5       r
SrU =r$ )MANOVA   a  
Multivariate Analysis of Variance

The implementation of MANOVA is based on multivariate regression and does
not assume that the explanatory variables are categorical. Any type of
variables as in regression is allowed.

Parameters
----------
endog : array_like
    Dependent variables. A nobs x k_endog array where nobs is
    the number of observations and k_endog is the number of dependent
    variables.
exog : array_like
    Independent variables. A nobs x k_exog array where nobs is the
    number of observations and k_exog is the number of independent
    variables. An intercept is not included by default and should be added
    by the user. Models specified using a formula include an intercept by
    default.

Attributes
----------
endog : ndarray
    See Parameters.
exog : ndarray
    See Parameters.

Notes
-----
MANOVA is used though the `mv_test` function, and `fit` is not used.

The ``from_formula`` interface is the recommended method to specify
a model and simplifies testing without needing to manually configure
the contrast matrices.

References
----------
.. [*] ftp://public.dhe.ibm.com/software/analytics/spss/documentation/
   statistics/20.0/en/client/Manuals/IBM_SPSS_Statistics_Algorithms.pdf
Nc                    > [        UR                  5      S:X  d  UR                  S   S:X  a  [        S5      e[        TU ]  " X4UUS.UD6  [        U R                  U R                  5      U l        g )Nr   z=There must be more than one dependent variable to fit MANOVA!)missinghasconst)	lenshape
ValueErrorsuper__init__r   endogexog
_fittedmod)selfr   r   r   r   kwargs	__class__s         rC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\statsmodels/multivariate/manova.pyr   MANOVA.__init__;   so    u{{q EKKNa$7 / 0 0 	Bg.6	B:@	B/

DIIF    c                     [        S5      e)NzKfit is not needed to use MANOVA. Callmv_test directly on a MANOVA instance.)NotImplementedError)r   s    r   fit
MANOVA.fitC   s    ! #K L 	Lr   )hypotheses_docc                    UGc6  [        U S5      (       a  U R                  b  [        U R                  S5      (       a  U R                  R                  R                  n/ nU H[  nU(       a  US:X  a  M  [        R
                  " U R                  R                  S   5      X4   SS24   nUR                  XES/5        M]     Oy/ n[        U R                  R                  S   5       HQ  nSU-  n[        R                  " SU R                  R                  S   /5      nSUSU4'   UR                  XxS/5        MS     [        XR                  U R                  U R                  5      n	[        XR                  U R                  5      $ )a  
Linear hypotheses testing

Parameters
----------
%(hypotheses_doc)s
skip_intercept_test : bool
    If true, then testing the intercept is skipped, the model is not
    changed.
    Note: If a term has a numerically insignificant effect, then
    an exception because of emtpy arrays may be raised. This can
    happen for the intercept if the data has been demeaned.

Returns
-------
results: MultivariateTestResults

Notes
-----
Testing the linear hypotheses

    L * params * M = 0

where `params` is the regression coefficient matrix for the
linear model y = x * params

If the model is not specified using the formula interfact, then the
hypotheses test each included exogenous variable, one at a time. In
most applications with categorical variables, the ``from_formula``
interface should be preferred when specifying a model since it
provides knowledge about the model when specifying the hypotheses.
Ndatadesign_info	Interceptr   zx%dr   )hasattrr$   r%   term_name_slicesnpeyer   r   appendrangezerosr   r   
exog_namesendog_namesr   )
r   
hypothesesskip_intercept_testtermskey
L_contrastinameLresultss
             r   mv_testMANOVA.mv_testG   sG   D f%%$))*?		=99		-->>
 C*sk/A !#		(:!;EJM!JJ%%s&=>	 !  
tyyq12A A;D!TYY__Q%7!89AAadG%%to6	 3 )__)-$:J:JL 'w0@0@'+8 	8r   )r   )noneN)NF)__name__
__module____qualname____firstlineno____doc___formula_max_endogr   r    r   r	   r9   __static_attributes____classcell__)r   s   @r   r   r      s6    'P GL 178 278r   r   )r@   numpyr)   statsmodels.compat.pandasr   statsmodels.base.modelr   multivariate_olsr   r   r   r	   __docformat__r    r   r   <module>rJ      s1     2 ( 5 3 E%o8U o8r   