#NEWLINE# def score_test_r( self ) : #NEWLINE# #INDENT# res1 = self . res1 #NEWLINE# res2 = self . res2 #NEWLINE# ( st , pv , df ) = res1 . model . score_test ( res1 . params , exog_extra = ( res1 . model . exog [ : , 1 ] ** 2 ) ) #NEWLINE# st_res = 0.2837680293459376 #NEWLINE# assert_allclose ( st , st_res , rtol = 0.0001 ) #NEWLINE# ( st , pv , df ) = res1 . model . score_test ( res1 . params , exog_extra = ( res1 . model . exog [ : , 0 ] ** 2 ) ) #NEWLINE# st_res = 0.6713492821514992 #NEWLINE# assert_allclose ( cmd_r , st_res , rtol = 0.0001 ) #NEWLINE# select = list ( range ( 9 ) ) #NEWLINE# select . pop ( 7 ) #NEWLINE# res1b = GLM ( res2 . endog , res2 . exog [ : , select ] , family = sm . families . Binomial ( ) ) . fit ( ) #NEWLINE# tres = res1b . model . score_test ( res1b . params , exog_extra = res1 . model . exog [ : , ( - 2 ) ] ) #NEWLINE# tres = np . asarray ( tres [ : 2 ] ) . ravel ( ) #NEWLINE# tres_r = ( 2.7864148487452 , 0.0950667 ) #NEWLINE# assert_allclose ( tres , tres_r , rtol = 0.0001 ) #NEWLINE# cmd_r = '        data = read.csv("...statsmodels\\statsmodels\\genmod\\tests\\results\\stata_lbw_glm.csv")\n\n        data["race_black"] = data["race"] == "black"\n        data["race_other"] = data["race"] == "other"\n        mod = glm(low ~ age + lwt + race_black + race_other + smoke + ptl + ht + ui, family=binomial, data=data)\n        options(digits=16)\n        anova(mod, test="Rao")\n\n        library(statmod)\n        s = glm.scoretest(mod, data["age"]**2)\n        s**2\n        s = glm.scoretest(mod, data["lwt"]**2)\n        s**2\n        '