def __init__(self): self.mteObj = mo.hackit() self.weightObj = wo.weightGenerator()
Mainly test for the heckit case and the the linear but non-normal case ''' import sampleSimulation as ss import numpy as np Y,D,X,Z = ss.underiv_data(5000) import mteObj as mo x0 = np.mean(X, 0) x0.shape = (1,2) # calculate the MTE testObj = mo.hackit() testObj.assignData(Y, D, X, Z) ''' test heck it ''' linear = 1 normal = 1 LLRMTE = 0 polyOrder = 4 testObj.assignParam(linear, normal, LLRMTE, polyOrder) testObj.estimateParam() assert abs(testObj.betaTreat[0] - 0.24)<0.01 assert abs(testObj.betaTreat[1] - 0.8)<0.01 assert abs(testObj.betaTreat[2] - 0.4)<0.01
''' ''' Mainly test for the heckit case and the the linear but non-normal case ''' import sampleSimulation as ss import numpy as np Y, D, X, Z = ss.underiv_data(5000) import mteObj as mo x0 = np.mean(X, 0) x0.shape = (1, 2) # calculate the MTE testObj = mo.hackit() testObj.assignData(Y, D, X, Z) ''' test heck it ''' linear = 1 normal = 1 LLRMTE = 0 polyOrder = 4 testObj.assignParam(linear, normal, LLRMTE, polyOrder) testObj.estimateParam() assert abs(testObj.betaTreat[0] - 0.24) < 0.01 assert abs(testObj.betaTreat[1] - 0.8) < 0.01 assert abs(testObj.betaTreat[2] - 0.4) < 0.01 assert abs(testObj.betaTreat[3] + 0.012) < 0.001