Summary of variables in model

The values here are slightly different from what we had at ISA and MPSA (and our ISQ submission) because we’re now using V-Dem 8.0 and AidData 3.1.

Summary of all variables included in models {#tbl:var-summary}
Variable Source Mean Std. Dev. Median Min Max N
Total aid (constant 2011 USD, millions) OECD and AidData 1,193 2,677 427.2 0 63,233 4,620
Proportion of contentious aid OECD and AidData 0.06 0.1 0.02 0 1 4,094
Proportion of aid to domestic NGOs USAID 0.04 0.13 0 0 1 3,839
Proportion of aid to foreign NGOs USAID 0.11 0.19 0 0 1 3,839
Total legal barriers @christensen2013 1.77 1.51 1 0 8.5 4,620
Barriers to advocacy @christensen2013 0.17 0.39 0 0 2 4,620
Barriers to entry @christensen2013 1.25 0.74 1 0 3 4,620
Barriers to funding @christensen2013 0.35 0.82 0 0 4.5 4,620
Civil society regulatory environment (CSRE) V-Dem 0.87 2.81 0.82 -6.14 6.29 4,354
Polity IV (0–10) V-Dem 5.02 3.08 5 0 10 4,554
GDP per capita (constant 2011 USD) UN and World Bank 6,008 10,672 2,524 74.4 122,422 4,327
Trade as % of GDP UN and World Bank 0.77 0.46 0.67 0.04 4.4 4,327
Corruption V-Dem 6.03 2.47 6.38 0.12 9.77 4,301
Internal conflict in last 5 years UCDP/PRIO 0.26 0.44 0 0 1 4,620
Natural disasters EM-DAT 1.73 3.17 1 0 43 4,620

Aid stuff

Proportion of US aid to types of NGOs

Total amounts over time:

channel total perc
oda.us.ngo.dom $5,657,894,514 1.09%
oda.us.ngo.int $12,674,549,597 2.44%
oda.us.ngo.us $27,679,409,629 5.34%

The US clearly favors US-based NGOs or international NGOs over domestic NGOs.

USAID data categorizes all aid as government-channeled before 2000 because of some quirk in the data.

So we just look at aid after 2000.

Restrictions and aid

List of countries included in models

All countries included in models (N = 140) {#tbl:countries}
Afghanistan Dominican Republic Lesotho Rwanda
Albania Ecuador Liberia Saudi Arabia
Algeria Egypt Lithuania Senegal
Angola El Salvador Macedonia Serbia
Argentina Equatorial Guinea Madagascar Sierra Leone
Armenia Eritrea Malawi Singapore
Azerbaijan Estonia Malaysia Slovakia
Bahrain Ethiopia Mali Slovenia
Bangladesh Fiji Mauritania Solomon Islands
Belarus Gabon Mauritius South Africa
Benin Gambia Mexico South Korea
Bhutan Georgia Moldova Sri Lanka
Bolivia Ghana Mongolia Sudan
Bosnia & Herzegovina Guatemala Montenegro Swaziland
Botswana Guinea Morocco Syria
Brazil Guinea-Bissau Mozambique Taiwan
Bulgaria Guyana Myanmar (Burma) Tajikistan
Burkina Faso Haiti Namibia Tanzania
Burundi Honduras Nepal Thailand
Cambodia Hungary Nicaragua Timor-Leste
Cameroon India Niger Togo
Central African Republic Indonesia Nigeria Trinidad & Tobago
Chad Iran North Korea Tunisia
Chile Iraq Oman Turkey
China Israel Pakistan Turkmenistan
Colombia Jamaica Panama Uganda
Comoros Jordan Papua New Guinea Ukraine
Congo - Brazzaville Kazakhstan Paraguay United Arab Emirates
Congo - Kinshasa Kenya Peru Uruguay
Costa Rica Kosovo Philippines Uzbekistan
Côte d’Ivoire Kuwait Poland Venezuela
Croatia Kyrgyzstan Portugal Vietnam
Cuba Laos Qatar Yemen
Cyprus Latvia Romania Zambia
Czechia Lebanon Russia Zimbabwe
LS0tCnRpdGxlOiAiTm9uLW1vZGVsIGFuYWx5c2lzIgphdXRob3I6ICJTdXBhcm5hIENoYXVkaHJ5IGFuZCBBbmRyZXcgSGVpc3MiCmRhdGU6ICJgciBmb3JtYXQoU3lzLnRpbWUoKSwgJyVGJylgIgpvdXRwdXQ6IAogIGh0bWxfZG9jdW1lbnQ6CiAgICBjb2RlX2ZvbGRpbmc6IGhpZGUKZWRpdG9yX29wdGlvbnM6IAogIGNodW5rX291dHB1dF90eXBlOiBjb25zb2xlCi0tLQoKYGBge3IgbG9hZC1saWJyYXJpZXMsIG1lc3NhZ2U9RkFMU0V9CmtuaXRyOjpvcHRzX2NodW5rJHNldChmaWcucmV0aW5hID0gMiwKICAgICAgICAgICAgICAgICAgICAgIHRpZHkub3B0cyA9IGxpc3Qod2lkdGgu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cGFuZCA9IGMoMCwgMCkpICsKICBzY2FsZV9jb2xvdXJfbWFudWFsKHZhbHVlcyA9IGMoImJsYWNrIiwgImdyZXk4MCIsICJncmV5NTAiKSwgbmFtZSA9IE5VTEwpICsKICBzY2FsZV9saW5ldHlwZV9tYW51YWwodmFsdWVzID0gYygic29saWQiLCAic29saWQiLCAiMjEiKSwgbmFtZSA9IE5VTEwpICsKICBndWlkZXMoY29sb3IgPSBndWlkZV9sZWdlbmQobnJvdyA9IDIpKSArCiAgbGFicyh4ID0gTlVMTCwgeSA9ICJOdW1iZXIgb2YgY291bnRyaWVzIikgKwogIHRoZW1lX2Rvbm9ycygpICsgCiAgdGhlbWUobGVnZW5kLmp1c3RpZmljYXRpb24gPSAibGVmdCIpICsKICBmYWNldF93cmFwKH4gYmFycmllcl9ncm91cCkKCmRjandfZnVuZGluZ19wbG90IDwtIGdncGxvdChmaWx0ZXIoZGYuYmFycmllcnMsIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJhcnJpZXJfZ3JvdXAgPT0gIkJhcnJpZXJzIHRvIGZ1bmRpbmciKSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZXMoeCA9IHllYXIsIHkgPSB2YWx1ZSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sb3IgPSBiYXJyaWVyX2Rpc3BsYXksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGluZXR5cGUgPSBiYXJyaWVyX2Rpc3BsYXkpKSArCiAgZ2VvbV9saW5lKHNpemUgPSAwLjUpICsKICBleHBhbmRfbGltaXRzKHkgPSBjKDAsIDQwKSkgKwogIHNjYWxlX3lfY29udGludW91cyhzZWMuYXhpcyA9IHNlY19heGlzKH4gLiAvIG51bS5jb3VudHJpZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWxzID0gcGVyY2VudF9mb3JtYXQoYWNjdXJhY3kgPSAxKSksCiAgICAgICAgICAgICAgICAgICAgIGV4cGFuZCA9IGMoMCwgMCkpICsKICBzY2FsZV9jb2xvdXJfbWFudWFsKHZhbHVlcyA9IGMoImJsYWNrIiwgImdyZXk4MCIsICJncmV5NTAiLCAiYmxhY2siLCAiZ3JleTgwIiksIG5hbWUgPSBOVUxMKSArCiAgc2NhbGVfbGluZXR5cGVfbWFudWFsKHZhbHVlcyA9IGMoInNvbGlkIiwgInNvbGlkIiwgInNvbGlkIiwgIjIxIiwgIjIxIiksIG5hbWUgPSBOVUxMKSArCiAgZ3VpZGVzKGNvbG9yID0gZ3VpZGVfbGVnZW5kKG5yb3cgPSAzKSwKICAgICAgICAgbGluZXR5cGUgPSBndWlkZV9sZWdlbmQobnJvdyA9IDMpKSArCiAgbGFicyh4ID0gTlVMTCwgeSA9ICJOdW1iZXIgb2YgY291bnRyaWVzIikgKwogIHRoZW1lX2Rvbm9ycygpICsgCiAgdGhlbWUobGVnZW5kLmp1c3RpZmljYXRpb24gPSAibGVmdCIpICsKICBmYWNldF93cmFwKH4gYmFycmllcl9ncm91cCkKCmRjandfYWR2b2NhY3lfcGxvdCA8LSBnZ3Bsb3QoZmlsdGVyKGRmLmJhcnJpZXJzLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFycmllcl9ncm91cCA9PSAiQmFycmllcnMgdG8gYWR2b2NhY3kiKSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZXMoeCA9IHllYXIsIHkgPSB2YWx1ZSwgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sb3IgPSBiYXJyaWVyX2Rpc3BsYXkpKSArCiAgZ2VvbV9saW5lKHNpemUgPSAwLjUpICsKICBleHBhbmRfbGltaXRzKHkgPSBjKDAsIDQwKSkgKwogIHNjYWxlX3lfY29udGludW91cyhzZWMuYXhpcyA9IHNlY19heGlzKH4gLiAvIG51bS5jb3VudHJpZXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGF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