propensity-score-matching's People
Forkers
marcellamontagnese shannonyu chaolidatateam evaxu-octanelending fahad021 gcbiotec idleartist tirthshah20 adityac07 rated-r-sundram yoyo-jdce matthh9797 nanaakwasiabayieboateng ericchlee shin-c junaidqazi frans-arya yhu586 humanfact bestermu ppundeer oliviaguo9868 pkuphyfw yangyangwgu wfb226 l294265421 wanludrame melwljy joziezz lovelovekathy nayanemaia z002021 yimin-gainlife ge526874 ziyit jayhoneylee527 yilintsai losmond2016 jesservillines louie-lou mohsinkaleem perfjohnsen harsha20032020 xihuishawpy riddhimanadib yumao3opropensity-score-matching's Issues
I'm getting a key-error when running the "perfom_matching_v2"-function
I want to perform propensity score matching using your jupyter notebook template. I have a sample of treated and untreated individuals where the treated group is smaller compared to the untreated group. Moreover, my outcome is continuous, and not categorical compared to yours - which should be fine aswell. I can run your code until the "perfom_matching_v2"-function (see below; cell 21 in your code). When I run it, I get KeyError: 37. Any idea why this could happen and how to solve it?
def perfom_matching_v2(row, indexes, df_data):
current_index = int(row['index']) # Obtain value from index-named column, not the actual DF index.
prop_score_logit = row['propensity_score_logit']
for idx in indexes[current_index,:]:
if (current_index != idx) and (row.treatment == 1) and (df_data.loc[idx].treatment == 0):
return int(idx)
df_data['matched_element'] = df_data.reset_index().apply(perfom_matching_v2, axis = 1, args = (indexes, df_data))
About your knn radius
In your jupyter notebook, you use Nearerst Neighbors to identify matching candidates.
caliper = np.std(df_data.propensity_score) * 0.25 knn = NearestNeighbors(n_neighbors=10 , p = 2, radius=caliper)
In this line, why you choose caliper as radius? Thank you.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.