#NEWLINE# def test_score_test_OLS( ) : #NEWLINE# #INDENT# from statsmodels.regression.linear_model import OLS #NEWLINE# np . random . seed ( 5 ) #NEWLINE# nobs = 100 #NEWLINE# sige = 0.5 #NEWLINE# x = np . random . uniform ( 0 , 1 , size = ( nobs , 5 ) ) #NEWLINE# x [ : , 0 ] = 1 #NEWLINE# beta = ( 1.0 / np . arange ( 1.0 , ( x . shape [ 1 ] + 1 ) ) ) #NEWLINE# y = ( x . dot ( beta ) + ( sige * np . random . randn ( nobs ) ) ) #NEWLINE# res_ols = OLS ( y , x ) . fit ( ) #NEWLINE# res_olsc = OLS ( y , x [ : , : ( - 2 ) ] ) . fit ( ) #NEWLINE# co = res_ols . compare_lm_test ( res_olsc , demean = False ) #NEWLINE# res_glm = GLM ( y , x [ : , : ( - 2 ) ] , family = sm . families . Gaussian ( ) ) . fit ( ) #NEWLINE# co2 = res_glm . model . score_test ( res_glm . params , exog_extra = x [ : , ( - 2 ) : ] ) #NEWLINE# assert_allclose ( ( ( res_olsc [ 0 ] * 97 ) / 100.0 ) , co2 [ 0 ] , rtol = 1e-13 )