Compute a tcontrast/t-test for a row vector array.
Parameters: | r_matrix : array-like
scale : float, optional
scale : scalar |
---|
Examples
>>> import numpy as np
>>> import scikits.statsmodels as sm
>>> data = sm.datasets.longley.Load()
>>> data.exog = sm.add_constant(data.exog)
>>> results = sm.OLS(data.endog, data.exog).fit()
>>> r = np.zeros_like(results.params)
>>> r[4:6] = [1,-1]
>>> print r
[ 0. 0. 0. 0. 1. -1. 0.]
r tests that the coefficients on the 5th and 6th independent variable are the same.
>>>T_Test = results.t_test(r) >>>print T_test <T contrast: effect=-1829.2025687192481, sd=455.39079425193762, t=-4.0167754636411717, p=0.0015163772380899498, df_denom=9> >>> T_test.effect -1829.2025687192481 >>> T_test.sd 455.39079425193762 >>> T_test.t -4.0167754636411717 >>> T_test.p 0.0015163772380899498