Logo

scikits.statsmodels.robust.robust_linear_model.RLMResults.t_test

RLMResults.t_test(r_matrix, q_matrix=None, scale=None)

Compute a tcontrast/t-test for a row vector array of the form Rb = q

where R is r_matrix, b = the parameter vector, and q is q_matrix.

Parameters :

r_matrix : array-like

A length p row vector specifying the linear restrictions.

q_matrix : array-like or scalar, optional

Either a scalar or a length p row vector.

scale : float, optional

An optional scale to use. Default is the scale specified by the model fit.

See also

t
method to get simpler t values
f_test
for f tests

Examples

>>> import numpy as np
>>> import scikits.statsmodels.api 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

Previous topic

sm.robust.robust_linear_model.RLMResults.t

Next topic

sm.robust.norms.AndrewWave

This Page