#NEWLINE# def sample_ivfake( exog ) : #NEWLINE# #INDENT# X = exog #NEWLINE# e = ( sige * np . random . normal ( size = nobs ) ) #NEWLINE# endog = ( np . dot ( X , beta ) + e ) #NEWLINE# z3 = ( np . dot ( X , np . array ( [ 2 , 1 , 0 ] ) ) + ( ( sige / 2.0 ) * np . random . normal ( size = nobs ) ) ) #NEWLINE# z4 = ( exog [ : , 1 ] + np . random . normal ( size = nobs ) ) #NEWLINE# instrument = np . column_stack ( [ X [ : , : 2 ] , z3 , z4 , X [ : , ( - 1 ) ] ] ) #NEWLINE# return ( endog , exog , instrument )