GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. --------------------------------------------------------------------------- ''' import LIVEstimator as liv import sampleSimulation as ss import pysal.spreg as foreignModel # get the first 100 observations for test Y, D, X, Z = ss.underiv_data(200) # first needs to estimate the propensity score psResult = foreignModel.Probit(D, Z) psHat = psResult.predy # then get the parameter residY, beta = liv.LLRresidualEst(Y, X, psHat) assert (beta[0] - 0.3139) < 0.0001 assert (beta[1] - 0.2651) < 0.0001 print 'LLRresidualEst LIV passes unit test' ''' If the beta can be correctly estimated, then the rest of the procedure of LIV method does not need unit test ''' polyOrder = 4 theta = liv.LLRKpPolyParam(residY, psHat, polyOrder)
#print test1, test2 #from mpi4py import MPI #import numpy #comm = MPI.COMM_WORLD #rank = comm.Get_rank() #if rank == 0: # data = numpy.arange(1000, dtype = 'i') # comm.Send([data, MPI.INT], dest = 1, tag = 77) #elif rank == 1: # data = numpy.empty(1000, dtype = 'i') # comm.Recv([data, MPI.INT], source = 0, tag = 77) import sampleSimulation as ss import localLinearRegression as LLR import numpy Y,D,X,Z = ss.underiv_data(500) h = numpy.arange(0.05,2,0.05) LLR.optimalBandwidthSelection(Y, X[:,0:1], h) # Retrieves the result calculated by job1 # The value of job1() is the same as sum_primes(100) # If the job has not been finished yet, execution will wait here until result is available
along with this program. If not, see <http://www.gnu.org/licenses/>. --------------------------------------------------------------------------- ''' import sampleSimulation as ss import numpy as np import estimatorInterface as ei # integration is numericially unstable, thus disable the warning! import warnings warnings.filterwarnings('ignore') # load the data Y, D, X, Z = ss.underiv_data(5000) # Set the x for the MTE x0 = np.mean(X, 0) x0.shape = (1, 2) testEstObj = ei.treatmentEffectEst() ''' ************************************************** Heck it: Linear Model, Normal Distribution ************************************************** ''' # calculate the MTE linear = 1 normal = 1 LLRMTE = 0
GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. --------------------------------------------------------------------------- ''' import LIVEstimator as liv import sampleSimulation as ss import pysal.spreg as foreignModel # get the first 100 observations for test Y,D,X,Z = ss.underiv_data(200) # first needs to estimate the propensity score psResult = foreignModel.Probit(D,Z) psHat = psResult.predy # then get the parameter residY, beta = liv.LLRresidualEst(Y, X, psHat) assert (beta[0]-0.3139)<0.0001 assert (beta[1]-0.2651)<0.0001 print 'LLRresidualEst LIV passes unit test' ''' If the beta can be correctly estimated, then the rest of the procedure of LIV method does not need unit test ''' polyOrder = 4