
    >hao                        S SK rS SKJr  S SKJr  S SKJr  S SK	J
r
Jr  S SKJr   " S S5      r " S	 S
5      rSS jr " S S5      rS rS r  SS jr " S S5      rSS jr  SS jr  SS jrS rSS jr  SS jrg)    N)f)t)stats)clean0fullrank)multipletestsc                   P    \ rS rSrSr  SS jrSS jrS rS rSS jr	SS	 jr
S
rg)ContrastResults
   a@  
Class for results of tests of linear restrictions on coefficients in a model.

This class functions mainly as a container for `t_test`, `f_test` and
`wald_test` for the parameters of a model.

The attributes depend on the statistical test and are either based on the
normal, the t, the F or the chisquare distribution.
Nc                    X@l         Ub[  SU l        X l        U R                  U l        XPl        X`l        [        U l        Xe4U l        [        R                  " X&U5      U l
        GOUbl  SU l        Xl        Xl        X0l        XPl        [        U l        U4U l        U R                  R                  [        R                  " U5      U5      S-  U l
        GO>SU;   Ga"  US   U l        US   U l        US   =U l        n	X0l        [!        ["        U R                  5      U l        UR%                  SS5      U l        U R                  S:X  a2  U R                  R                  U R                  U5      U l
        XPl        O [        R&                  " U	[        R(                  5      U l
        [        R*                  " U	5      ) n
U R                  R                  [        R                  " X   5      5      S-  U R                  U
'   O[        R(                  U l
        [        R,                  " U R                  5      U l
        U R                   b8  [/        [1        U R                   5      5       Vs/ s H  nS	U-  PM
     snU l        g S U l        g s  snf )
NFr      	statisticdistribution	dist_args chi2zc%d)effectr   fvaluer   df_denomdf_numfdistdistr   sfpvaluetvaluesd	student_tnpabsgetattrr   get	full_likenanisnansqueezerangelenc_names)selfr   r   r   r   r   r   alphakwdsvaluenot_naniis               mC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\statsmodels/stats/contrast.py__init__ContrastResults.__init__   s    = #DK![[DN$M KDI$/DN((1h7DK] #DKNG$M!DI&[DN)),,rvvay(;a?DKD  $^ 4D!+.DN"&{"33DK%Gt'8'89DI!XXk26DN  F*"iill4>>8D ( ll5"&&988E?*'+yy||BFF5>4J'Ka'OG$&&DK jj-;;"16s4;;7G1HI1H2EBJ1HIDLDL Js   $Jc                 &   U R                   bz  U R                  R                  " SUS-  -
  /U R                  Q76 nU R                   X R                  -  -
  nU R                   X R                  -  -   n[
        R                  " X445      $ [        S5      e)a  
Returns the confidence interval of the value, `effect` of the constraint.

This is currently only available for t and z tests.

Parameters
----------
alpha : float, optional
    The significance level for the confidence interval.
    ie., The default `alpha` = .05 returns a 95% confidence interval.

Returns
-------
ci : ndarray, (k_constraints, 2)
    The array has the lower and the upper limit of the confidence
    interval in the columns.
   g       @z!Confidence Interval not available)r   r   ppfr   r   r   column_stackNotImplementedError)r*   r+   qloweruppers        r0   conf_intContrastResults.conf_intH   sv    $ ;;"		a%"*n>t~~>AKK!gg+-EKK!gg+-E??E>22%&IJJ    c                 >    U R                  5       R                  5       $ N)summary__str__r*   s    r0   rA   ContrastResults.__str__c   s    ||~%%''r=   c                 T    [        U R                  5      S-   U R                  5       -   $ N
str	__class__rA   rB   s    r0   __repr__ContrastResults.__repr__f   !    4>>"T)DLLN::r=   c           
         U R                   b  Uc  SnOUS:X  a  SnU R                  S:H  nSnUc  U R                  nSSKJn  [
        R                  " U R                  5      nU" X R                   U R                  U R                  XpR                  U5      4XQUX2S9nU$ [        U S	5      (       a:  S
[        U R                  5      U R                  U R                  U R                  4-  $ U R                  S:X  a1  SU R                  U R                  U R                  U R                  4-  $ SU R                  < SU R                  < S3$ )a  Summarize the Results of the hypothesis test

Parameters
----------
xname : list[str], optional
    Default is `c_##` for ## in the number of regressors
alpha : float
    significance level for the confidence intervals. Default is
    alpha = 0.05 which implies a confidence level of 95%.
title : str, optional
    Title for the params table. If not None, then this replaces the
    default title

Returns
-------
smry : str or Summary instance
    This contains a parameter results table in the case of t or z test
    in the same form as the parameter results table in the model
    results summary.
    For F or Wald test, the return is a string.
NzTest for Constraints r   constraintsr   )summary_params)ynamexnameuse_ttitler+   r   z0<F test: F=%s, p=%s, df_denom=%.3g, df_num=%.3g>r   z9<Wald test (%s): statistic=%s, p-value=%s, df_denom=%.3g>z<Wald test: statistic=z
, p-value=>)r   r   r)   statsmodels.iolib.summaryrP   r   
atleast_1dr   r   r   r;   hasattrreprr   r   r   )	r*   rR   r+   rT   rS   rQ   rP   pvaluessumms	            r0   r@   ContrastResults.summaryi   s7   , ;;" }." &&#-EE}@mmDKK0G!4dggt~~#*MM%,@#B(-%(-<D KT8$$F%t{{DMMKK!! " &(O%%t~~t{{MM## $ ) NNDKK1 2r=   c           
         U R                   bm  U R                  S:H  nSnUc  U R                  nSSKJn  U" X R                   U R
                  U R                  U R                  U R                  U5      4UXUS9nU$ [        S5      e)z`Return the parameter table as a pandas DataFrame

This is only available for t and normal tests
r   rO   r   )summary_params_frame)rQ   rR   rS   r+   zonly available for t and z)
r   r   r)   rV   r^   r   r   r   r;   r7   )r*   rR   r+   rS   rQ   r^   r[   s          r0   summary_frameContrastResults.summary_frame   s    
 ;;"&&#-EE}F'{{DGG)-)-u)=)?FK/4/4	6D
 K &&BCCr=   )r)   r   r   r   r   r   r   r   r   r   r   r   )NNNNNN皙?)ra   )Nra   N)Nra   )__name__
__module____qualname____firstlineno____doc__r1   r;   rA   rJ   r@   r_   __static_attributes__r   r=   r0   r
   r
   
   s3     GK$(1 fK6(;72tDr=   r
   c                   :    \ rS rSrSrS r\" \5      rS rS r	Sr
g)Contrast   a  
This class is used to construct contrast matrices in regression models.

They are specified by a (term, design) pair.  The term, T, is a linear
combination of columns of the design matrix. The matrix attribute of
Contrast is a contrast matrix C so that

colspan(dot(D, C)) = colspan(dot(D, dot(pinv(D), T)))

where pinv(D) is the generalized inverse of D. Further, the matrix

Tnew = dot(C, D)

is full rank. The rank attribute is the rank of

dot(D, dot(pinv(D), T))

In a regression model, the contrast tests that E(dot(Tnew, Y)) = 0
for each column of Tnew.

Parameters
----------
term : array_like
design : array_like

Attributes
----------
contrast_matrix

Examples
--------
>>> import statsmodels.api as sm
>>> from statsmodels.stats.contrast import Contrast
>>> import numpy as np
>>> np.random.seed(54321)
>>> X = np.random.standard_normal((40,10))
# Get a contrast
>>> new_term = np.column_stack((X[:,0], X[:,2]))
>>> c = Contrast(new_term, X)
>>> test = [[1] + [0]*9, [0]*2 + [1] + [0]*7]
>>> np.allclose(c.contrast_matrix, test)
True

Get another contrast

>>> P = np.dot(X, np.linalg.pinv(X))
>>> resid = np.identity(40) - P
>>> noise = np.dot(resid,np.random.standard_normal((40,5)))
>>> new_term2 = np.column_stack((noise,X[:,2]))
>>> c2 = Contrast(new_term2, X)
>>> print(c2.contrast_matrix)
[ -1.26424750e-16   8.59467391e-17   1.56384718e-01  -2.60875560e-17
-7.77260726e-17  -8.41929574e-18  -7.36359622e-17  -1.39760860e-16
1.82976904e-16  -3.75277947e-18]

Get another contrast

>>> zero = np.zeros((40,))
>>> new_term3 = np.column_stack((zero,X[:,2]))
>>> c3 = Contrast(new_term3, X)
>>> test2 = [0]*2 + [1] + [0]*7
>>> np.allclose(c3.contrast_matrix, test2)
True
c                 \    [        U S5      (       d  U R                  5         U R                  $ )z#
Gets the contrast_matrix property
_contrast_matrix)rX   compute_matrixrl   rB   s    r0   _get_matrixContrast._get_matrix   s*     t/00!$$$r=   c                 p    [         R                  " U5      U l        [         R                  " U5      U l        g r?   )r   asarraytermdesign)r*   rr   rs   s      r0   r1   Contrast.__init__  s"    JJt$	jj(r=   c                 4   U R                   nUR                  S:X  a	  USS2S4   n[        U5      U l        U R                  U l        [        U R                  U R
                  5      U l         U R                  R                  S   U l
        g!   SU l
         g= f)z
Construct a contrast matrix C so that

colspan(dot(D, C)) = colspan(dot(D, dot(pinv(D), T)))

where pinv(D) is the generalized inverse of D=design.
r4   N)rr   ndimr   Trs   Dcontrastfromcolsrl   matrixshaperank)r*   rw   s     r0   rm   Contrast.compute_matrix
  s{     II66Q;!D&	A 0 @	))!,DI	DIs   -B 	B)rx   rw   rl   rs   r|   rr   N)rb   rc   rd   re   rf   rn   propertycontrast_matrixr1   rm   rg   r   r=   r0   ri   ri      s#    ?@% {+O)r=   ri   c                 l   [         R                  " U 5      n [         R                  " U5      nUR                  u  p4U R                  S   U:w  a  U R                  S   U:w  a  [        S5      eUc  [         R                  R                  U5      nU R                  S   U:X  a!  [         R                  " X 5      R                  nOAU n[         R                  " U[         R                  " XR                  5      5      R                  n[         R                  " XR                  5      n[        UR                  5      S:X  a	  US4Ul        [         R                  R                  U5      UR                  S   :w  a+  [        U5      n[         R                  " X&5      R                  n[         R                  " U5      $ )aF  
From an n x p design matrix D and a matrix L, tries
to determine a p x q contrast matrix C which
determines a contrast of full rank, i.e. the
n x q matrix

dot(transpose(C), pinv(D))

is full rank.

L must satisfy either L.shape[0] == n or L.shape[1] == p.

If L.shape[0] == n, then L is thought of as representing
columns in the column space of D.

If L.shape[1] == p, then L is thought of as what is known
as a contrast matrix. In this case, this function returns an estimable
contrast corresponding to the dot(D, L.T)

Note that this always produces a meaningful contrast, not always
with the intended properties because q is always non-zero unless
L is identically 0. That is, it produces a contrast that spans
the column space of L (after projection onto the column space of D).

Parameters
----------
L : array_like
D : array_like
r   r4   zshape of L and D mismatched)r   rq   r{   
ValueErrorlinalgpinvdotrw   r(   matrix_rankr   r&   )Lrx   pseudonpCLps          r0   ry   ry      s)   < 	

1A


1A77DAwwqzQ1771:?677~"wwqzQFF6FF6266!SS>*,,	33B
288}q6	yyR BHHQK/b\FF6  ::a=r=   c                   D    \ rS rSr  S	S jr\S 5       rS rS rS r	Sr
g)
WaldTestResultsi\  Nc                    X@l         X l        Xl        X0l        Ubb  US   R                  U l        US   R                  U l        US   R                  U l        U R                  S:X  a  US   R                  U l        g g U R                  S:X  a*  [        R                  U l
        U R                  S   U l        OJU R                  S:X  a/  [        R                  U l
        U R                  u  U l        U l        O[        S5      eUc7  U R                  R                  " [        R                  " U5      /UQ76 U l        g XPl        g )	Nr   r   df_constraintr   r   r   r   z)only F and chi2 are possible distribution)tabler   r   r   valuesrZ   df_constraintsr   r   r   r   r   r   r   r   r    )r*   r   r   r   r   rZ   s         r0   r1   WaldTestResults.__init___  s   
("" ";/66DN ?11DL"'"8"?"?D  C' %j 1 8 8 (   F*!JJ	&*nnQ&7#""c)!GG	59^^2#T] !!LMM#yy||BFF9,=J	J&r=   c                     SU R                   -  nU R                   US/nU R                   S:X  a  UR                  S5        U$ )z'column names for summary table
        zP>%szdf constraintr   zdf denom)r   append)r*   pr_test	col_namess      r0   r   WaldTestResults.col_names  sH    
 4,,,&&A	#Z(r=   c                     [        U S5      (       a  U R                  $ [        [        U R                  R
                  U R                  5      5      nU R                  R                  US9U l        U R                  $ )N_dframe)columns)	rX   r   dictzipr   r   r   renamedframe)r*   renamings     r0   r_   WaldTestResults.summary_frame  s[    4##<<DJJ..?@jj'''9{{r=   c                 >    U R                  5       R                  5       $ r?   )r_   	to_stringrB   s    r0   rA   WaldTestResults.__str__  s    !!#--//r=   c                 T    [        U R                  5      S-   U R                  5       -   $ rE   rG   rB   s    r0   rJ   WaldTestResults.__repr__  rL   r=   )	r   r   r   r   r   r   rZ   r   r   )NN)rb   rc   rd   re   r1   r~   r   r_   rA   rJ   rg   r   r=   r0   r   r   \  s5     BF 'D  0;r=   r   c                     [         R                  " U S5      n[        U6  Vs/ s H  nXS       SXS       3PM     nnU$ s  snf )z8helper function for labels for pairwise comparisons
    r4   -r   )r   triu_indicesr   )k_levellevel_namesidx_pairs_allnamelabelss        r0   _get_pairs_labelsr     s^     OOGQ/M}-/-$ !W%&aG(<'=>-  /M/s   Ac                    US-
  n[         R                  " US5      n[        US   5      n[         R                  " XS45      nSU[         R                  " U5      US   4'   SU[         R                  " U5      US   4'   [         R
                  " U5      n[         R                  " Xv4SS9nUR                  S   n	[         R                  " X45      n
XSS2X"U-   24'   U
$ )a  create pairwise contrast for reference coding

currently not used,
using encoding contrast matrix is more general, but requires requires
factor information from patsy design_info.


Parameters
----------
k_params : int
    number of parameters
k_level : int
    number of levels or categories (including reference case)
idx_start : int
    Index of the first parameter of this factor. The restrictions on the
    factor are inserted as a block in the full restriction matrix starting
    at column with index `idx_start`.

Returns
-------
contrasts : ndarray
    restriction matrix with k_params columns and number of rows equal to
    the number of restrictions.
r4   r   )axisN)r   r   r(   zerosarangeeyeconcatenater{   )k_paramsr   	idx_start
k_level_m1	idx_pairskc_pairsc_referenceck_all	contrastss              r0   _contrast_pairsr     s    2 1J
A.IIaLAhh'G*,GBIIaL)A,&'*+GBIIaL)A,&'&&$K
-A6AGGAJE%*+I78a3334r=   c                     U R                  U5      nUR                  US9n[        U5      [        La  U/nU H-  n[	        UR
                  XS9n	U	S   USU-  '   U	S   USU-  '   M/     U$ )as  perform t_test and add multiplicity correction to results dataframe

Parameters
----------
result results instance
    results of an estimated model
contrasts : ndarray
    restriction matrix for t_test
method : str or list of strings
    method for multiple testing p-value correction, default is'hs'.
alpha : float
    significance level for multiple testing reject decision.
ci_method : None
    not used yet, will be for multiplicity corrected confidence intervals
contrast_names : {list[str], None}
    If contrast_names are provided, then they are used in the index of the
    returned dataframe, otherwise some generic default names are created.

Returns
-------
res_df : pandas DataFrame
    The dataframe contains the results of the t_test and additional columns
    for multiplicity corrected p-values and boolean indicator for whether
    the Null hypothesis is rejected.
)rR   )methodr+   r4   z	pvalue-%sr   z	reject-%s)t_testr_   typelistr   r   )
resultr   r   r+   	ci_methodcontrast_namesttres_dfmethmts
             r0   t_test_multir     s    6 
y	!BN3FF|4299T?%'U{T!"%'U{T!"  Mr=   c                       \ rS rSrSrS rSrg)MultiCompResulti  z\class to hold return of t_test_pairwise

currently just a minimal class to hold attributes.
c                 :    U R                   R                  U5        g r?   )__dict__update)r*   kwargss     r0   r1   MultiCompResult.__init__  s    V$r=   r   N)rb   rc   rd   re   rf   r1   rg   r   r=   r0   r   r     s    %r=   r   c                     U R                   u  pE[        R                  " XA45      nUc  XSS2X"U-   24'   U$ XSS2U4'   U$ )a  helper function to expand constraints to a full restriction matrix

Parameters
----------
contrasts : ndarray
    restriction matrix for t_test
k_params : int
    number of parameters
idx_start : int
    Index of the first parameter of this factor. The restrictions on the
    factor are inserted as a block in the full restriction matrix starting
    at column with index `idx_start`.
index : slice or ndarray
    Column index if constraints do not form a block in the full restriction
    matrix, i.e. if parameters that are subject to restrictions are not
    consecutive in the list of parameters.
    If index is not None, then idx_start is ignored.

Returns
-------
contrasts : ndarray
    restriction matrix with k_params columns and number of rows equal to
    the number of restrictions.
N)r{   r   r   )r   r   r   indexk_ck_pr   s          r0   _embed_constraintsr     sQ    4 HC
#!A},5!YS(
() H  !U(Hr=   c                     U nUR                   u  pVSSKJs  Js  Jn  US;   a  UR                  U5      * nO[        S5      eUR                  U5      n	Ub  Uc  [        S5      e[        XU5      n	U	$ )a  helper function to create constraints based on encoding matrix

Parameters
----------
encoding_matrix : ndarray
    contrast matrix for the encoding of a factor as defined by patsy.
    The number of rows should be equal to the number of levels or categories
    of the factor, the number of columns should be equal to the number
    of parameters for this factor.
comparison : str
    Currently only 'pairwise' is implemented. The restriction matrix
    can be used for testing the hypothesis that all pairwise differences
    are zero.
k_params : int
    number of parameters
idx_start : int
    Index of the first parameter of this factor. The restrictions on the
    factor are inserted as a block in the full restriction matrix starting
    at column with index `idx_start`.

Returns
-------
contrast : ndarray
    Contrast or restriction matrix that can be used in hypothesis test
    of model results. The number of columns is k_params.
r   N)pairwisepwpairsz!currentlyonly pairwise comparisonz3if k_params is not None, then idx_start is required)
r{   #statsmodels.sandbox.stats.multicompsandboxr   	multicompcontrast_allpairsr7   r   r   r   )
encoding_matrix
comparisonr   r   cmr   r   mcc_allr   s
             r0   _constraints_factorr   &  s    : 
B88LG4400%%g..!"EFF		"I ( ) )&yIF	r=   c           	      .   U R                   R                  R                  nUR                  R	                  U5      nUR
                  U   nUR                  U   R                  n	U(       d$  [        UR                  5      S:  a  [        S5      eUR                  S   n
UR                  U
   R                  nUb2  [        U5      [        U5      :X  a  UnO[        S[        U5      -  5      e[        U5      nUR                  U   S   R                  U
   R                  n[        U R                   5      n[#        X5      nSSKJs  Js  Jn  UR-                  U5      * nUR/                  U5      n[1        UX5      n[3        U UUSX?S9n[5        UUUUUS9nU$ )a  
Perform pairwise t_test with multiple testing corrected p-values.

This uses the formula design_info encoding contrast matrix and should
work for all encodings of a main effect.

Parameters
----------
result : result instance
    The results of an estimated model with a categorical main effect.
term_name : str
    name of the term for which pairwise comparisons are computed.
    Term names for categorical effects are created by patsy and
    correspond to the main part of the exog names.
method : {str, list[str]}
    multiple testing p-value correction, default is 'hs',
    see stats.multipletesting
alpha : float
    significance level for multiple testing reject decision.
factor_labels : {list[str], None}
    Labels for the factor levels used for pairwise labels. If not
    provided, then the labels from the formula design_info are used.
ignore : bool
    Turn off some of the exceptions raised by input checks.

Returns
-------
MultiCompResult
    The results are stored as attributes, the main attributes are the
    following two. Other attributes are added for debugging purposes
    or as background information.

    - result_frame : pandas DataFrame with t_test results and multiple
      testing corrected p-values.
    - contrasts : matrix of constraints of the null hypothesis in the
      t_test.

Notes
-----

Status: experimental. Currently only checked for treatment coding with
and without specified reference level.

Currently there are no multiple testing corrected confidence intervals
available.
r4   z%interaction effects not yet supportedr   Nz0factor_labels has the wrong length, should be %d)r   r   r+   r   )result_framer   rr   contrast_labelsterm_encoding_matrix)modeldatadesign_info
term_namesr   termsterm_slicesstartr(   factorsr   factor_infos
categoriesterm_codingscontrast_matricesrz   paramsr   r   r   r   r   r   r   r   r   r   )r   	term_namer   r+   factor_labelsignoredesinfoterm_idxrr   r   factorcatr   r   r   r   r   c_all_pairscontrasts_subr   r   ress                         r0   t_test_pairwiser  U  sz   b ll++G!!''	2H=="D##D)//Ic$,,'!+@AA\\!_F


v
&
1
1C }S)CORUVYRZZ[[ #hG			d	#A	&	8	8	@	G	GB6==!Hw,F44''00KOOB'M"=(FI&)Fd %>F
v$-#*0/1	3C
 Jr=   c                     X-  nX-  nX4-
  $ )zoffset to the value of a linear constraint for new params

usage:
(cm, v) is original constraint

vo = offset_constraint(cm, res2.params, params_alt)
fs = res2.wald_test((cm, v + vo))
nc = fs.statistic * fs.df_num

r   )r_matrix
params_est
params_altdiff_estdiff_alts        r0   _offset_constraintr    s     $H$Hr=   c                     Uc  X-  U-
  nUR                  US9nU(       a$  U[        R                  R                  Xd5      -  nU$ U[        R                  " [        R
                  " U5      5      -  nU$ )a  Moncentrality parameter for a wald test in model results

The null hypothesis is ``diff = r_matrix @ params - value = 0``

Parameters
----------
params : ndarray
    parameters of the model at which to evaluate noncentrality. This can
    be estimated parameters or parameters under an alternative.
r_matrix : ndarray
    Restriction matrix or contrasts for the Null hypothesis
value : None or ndarray
    Value of the linear combination of parameters under the null
    hypothesis. If value is None, then it will be replaced by zero.
results : Results instance of a model
    The results instance is used to compute the covariance matrix of the
    linear constraints using `cov_params.
diff : None or ndarray
    If diff is not None, then it will be used instead of
    ``diff = r_matrix @ params - value``
joint : bool
    If joint is True, then the noncentrality parameter for the joint
    hypothesis will be returned.
    If joint is True, then an array of noncentrality parameters will be
    returned, where elements correspond to rows of the restriction matrix.
    This correspond to the `t_test` in models and is not a quadratic form.

Returns
-------
nc : float or ndarray
    Noncentrality parameter for Wald tests, correspondig to `wald_test`
    or `t_test` depending on whether `joint` is true or not.
    It needs to be divided by nobs to obtain effect size.


Notes
-----
Status : experimental, API will likely change

)r  )
cov_paramsr   r   solvesqrtdiag)r   r  r-   resultsdiffjointcov_cncs           r0   wald_test_noncentr    sm    R | 5(1EBIIOOE00 I BGGBGGEN++Ir=   c                 ,   Uc  SnUc  X-  U-
  nUnUR                  U5      R                  UR                  5      nU(       a$  U[        R                  R	                  Xt5      -  nU$ U[        R
                  " [        R                  " U5      5      -  nU$ )a8  noncentrality parameter for a wald test

The null hypothesis is ``diff = r_matrix @ params - value = 0``

Parameters
----------
params : ndarray
    parameters of the model at which to evaluate noncentrality. This can
    be estimated parameters or parameters under an alternative.
r_matrix : ndarray
    Restriction matrix or contrasts for the Null hypothesis

value : None or ndarray
    Value of the linear combination of parameters under the null
    hypothesis. If value is None, then it will be replace by zero.
cov_params : ndarray
    covariance matrix of the parameter estimates
diff : None or ndarray
    If diff is not None, then it will be used instead of
    ``diff = r_matrix @ params - value``
joint : bool
    If joint is True, then the noncentrality parameter for the joint
    hypothesis will be returned.
    If joint is True, then an array of noncentrality parameters will be
    returned, where elements correspond to rows of the restriction matrix.
    This correspond to the `t_test` in models and is not a quadratic form.

Returns
-------
nc : float or ndarray
    Noncentrality parameter for Wald tests, correspondig to `wald_test`
    or `t_test` depending on whether `joint` is true or not.
    It needs to be divided by nobs to obtain effect size.


Notes
-----
Status : experimental, API will likely change
r   )r   rw   r   r   r  r  r  )	r   r  r-   r  r  r  r   r  r  s	            r0   wald_test_noncent_genericr    s    R }| 5(AEE*!!!##&EBIIOOE00 I BGGBGGEN++Ir=   r?   )hsra   NN)r   NN)r  ra   NF)NT)numpyr   scipy.statsr   r   r   r   scipyr   statsmodels.tools.toolsr   r   statsmodels.stats.multitestr   r
   ri   ry   r   r   r   r   r   r   r   r  r  r  r  r   r=   r0   <module>r     s     " &  4 5mD mDbb bJ8x?; ?;J'T HL $$N% % F JN"&,^ ;?/4Qh 1h IM$(5r=   