-
Notifications
You must be signed in to change notification settings - Fork 0
/
endline1-analysis.Rmd
1986 lines (1547 loc) · 84.4 KB
/
endline1-analysis.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Endline R1 Data Report"
author: "Cyrus Samii"
date: "2/12/2019-present"
output:
word_document:
toc: yes
html_notebook:
number_sections: yes
html_document:
df_print: paged
number_sections: yes
toc: yes
---
# Set up
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE,
results = 'asis')
knitr::opts_knit$set(root.dir="~/Google Drive/USAID Paraguay inclusive Value Chains/Data")
```
```{r, include=FALSE}
library(rio)
library(summarytools)
st_options(plain.ascii = FALSE, # This is a must in Rmd documents
style = "rmarkdown", # idem
dfSummary.varnumbers = FALSE, # Keeps results narrow
dfSummary.valid.col = FALSE) # idem
library(knitr)
library(psych)
library(gmodels)
library(estimatr)
library(gdata)
library(doBy)
source("scripts/analysis-functions.R")
```
We work out of the following folder:
`~/Google Drive/USAID Paraguay inclusive Value Chains/Data/endline-data-r1`
We load in the data, which are stored in Stata .dta format. I print everything here in the report so it is clear what files we have.
```{r}
HH.sc <- as.data.frame(import("endline-data-r1/Cargaas E+E/Finales/1_Base_de_datos_principal_10_12_2018.dta"))
roster <- as.data.frame(import("endline-data-r1/Cargaas E+E/Finales/2_personas_10_12_2018.dta"))
transport <- as.data.frame(import("endline-data-r1/Cargaas E+E/Finales/3_transporte_10_12_2018.dta"))
lote_princ <- as.data.frame(import("endline-data-r1/Cargaas E+E/Finales/4_lote_principal_10_12_2018.dta"))
lote_secun <- as.data.frame(import("endline-data-r1/Cargaas E+E/Finales/5_lote_secundario_10_12_2018.dta"))
prod_pecu <- as.data.frame(import("endline-data-r1/Cargaas E+E/Finales/6_produccion_pecuaria_10_12_2018.dta"))
prod_deri <- as.data.frame(import("endline-data-r1/Cargaas E+E/Finales/7_productos_derivados_10_12_2018.dta"))
tierr_vend <- as.data.frame(import("endline-data-r1/Cargaas E+E/Finales/8_tierras_que_vendio_10_12_2018.dta"))
tierr_comp <- as.data.frame(import("endline-data-r1/Cargaas E+E/Finales/9_tierras_que_compro_10_12_2018.dta"))
tierr_alqu_a <- as.data.frame(import("endline-data-r1/Cargaas E+E/Finales/10_tierras_que_alquilo_a_otros_10_12_2018.dta"))
tierr_alqu_d <- as.data.frame(import("endline-data-r1/Cargaas E+E/Finales/11_tierras_que_alquilo_de_otros_10_12_2018.dta"))
design_d <- as.data.frame(import("working/covdata-w-treat.csv"))
```
```{r, echo=FALSE}
HH.sc$dist <- as.character(HH.sc[,"_2_distrito"])
HH.sc$dist[as.character(HH.sc[,"_2_distrito"])=="Azote'y"] <- "Azotey"
HH.sc$dist[as.character(HH.sc[,"_2_distrito"])=="General Elizardo Aquino"] <- "Gral. E. Aquino"
HH.sc$dist[as.character(HH.sc[,"_2_distrito"])=="Guayaibi"] <- "Guayaivi"
HH.sc$dist[as.character(HH.sc[,"_2_distrito"])=="Itacurubi del Rosario"] <- "Itacurbi del Rosario"
HH.sc$dist[as.character(HH.sc[,"_2_distrito"])=="Jasy Kañy"] <- "Jasy Kany"
HH.sc$dist[as.character(HH.sc[,"_2_distrito"])=="Yby Pyta"] <- "Yvy Pyta"
HH.sc$dist[as.character(HH.sc[,"_2_distrito"])=="Yby Ya'u"] <- "Yby Yau"
HH.sc$dist[as.character(HH.sc[,"_2_distrito"])=="Yrybukua"] <- "Yryvukua"
HH <- cbind(design_d[match(HH.sc$dist, as.character(design_d$distrito)), ], HH.sc)
HH <- HH[order(HH$treated, HH$dist), ]
HH$leader <- HH[,"_17_lider_sino"]
HH$leader[is.na(HH[,"_17_lider_sino"])] <- 0
```
# Topline conclusions to inform second wave
* Much of the action is at the level of *leaders* and the *organizations*. Not much seems to have trickled down to non-leader producers, in terms of either information or opportunities for participation. Need to be sure in endline that we have a good leaders sample. We want to follow up with these leaders to see if things have progressed. Is there any other information that might allow us to discern who might be a secondary leader to the president? That could increase the number of people on which we might see effects.
* *Avoid skip patterns!!* In a number of sections we gathered almost no information because we asked a poorly worded yes-no question to start, and then conditioned the rest of the section on whether they answered "yes". As a result, we received no information from the vast majority of respondents, making the data from those sections almost unusable.
# Democratizing producer-municipality interactions
## Perceptions of democratic access and responsiveness (B)
The first set of indicators get at producers' perceptions that organization can meaningfully engage with municipal leaders, and that mayors will be responsive to producers' priorities. These are measured in module B of the household surveys. Here is a summary of the raw data for these questions:
```{r, echo=F}
print(dfSummary(HH[,grep("_b_", names(HH))]), method="render")
```
The key variables of interest are B1, B2, and B3.
### Data prep
B1 gets at "do you think institutionalized processes are in place for voicing demands?" They are coded as 1 being "clear procedures exist, they are followed, municipality responds", through to 3 being "no procedures, mayor doesn't respond, and people don't think it's worth trying." We will reverse code so that higher values imply more responsiveness. Need to attend to missing data too, because this will mess everything up. We can code missing as 3, and then interpret the variable as whether people could affirm that there are procedures that exist to some degree.
```{r}
HH[,"_b_1_situacion_1"][HH[,"_b_1_situacion_1"] %in% c(99, 100)] <- NA
HH[,"_b_1_situacion_1"][is.na(HH[,"_b_1_situacion_1"])] <- 3
HH[,"use_b_1_situacion_1"] <- 3-HH[,"_b_1_situacion_1"]
kable(table(HH[,"use_b_1_situacion_1"], HH[,"_b_1_situacion_1"], useNA="always"))
```
B2 gets at "do you think the institutions are responsive to people without special connections?" Essentialy, code 1 as "yes" and either 2 or 3 as "no". So we need to do a recode, which takes value 1 if respondent said response 1 and then zero otherwise:
```{r}
HH[,"use_b_2_situacion_2"] <- as.numeric(HH[,"_b_2_situacion_2"]==1&!is.na(HH[,"_b_2_situacion_2"]))
kable(table(HH[,"use_b_2_situacion_2"], HH[,"_b_2_situacion_2"], useNA="always"))
```
B3 gets at "do you actually use the institutions to voice demands?" We will code as 1 for "yes" and then 0 for otherwise.
```{r}
HH[,"use_b_3_participacion"] <- as.numeric(HH[,"_b_3_participacion"]==1&!is.na(HH[,"_b_3_participacion"]))
kable(table(HH[,"use_b_3_participacion"], HH[,"_b_3_participacion"], useNA="always"))
```
### Basic analyses
Cross-tabs:
```{r}
tab_b1b2 <- with(HH, table(use_b_1_situacion_1, use_b_2_situacion_2, useNA="always"))
tab_b1b2_nona <- with(HH, table(use_b_1_situacion_1, use_b_2_situacion_2, useNA="no"))
tab_b1b3 <- with(HH, table(use_b_1_situacion_1, use_b_3_participacion, useNA="always"))
tab_b1b3_nona <- with(HH, table(use_b_1_situacion_1, use_b_3_participacion, useNA="no"))
tab_b2b3 <- with(HH, table(use_b_2_situacion_2, use_b_3_participacion, useNA="always"))
tab_b2b3_nona <- with(HH, table(use_b_2_situacion_2, use_b_3_participacion, useNA="no"))
kable(tab_b1b2)
print(summary(tab_b1b2_nona))
kable(tab_b1b3)
print(summary(tab_b1b3_nona))
kable(tab_b2b3)
print(summary(tab_b2b3_nona))
```
All the variables exhibit statistically strong bivariate associations (as evident from the chi-sq. test p values).
We want to combine into an index. First, let's look at correlation and also Cronbach's alpha:
```{r}
corr_b <- cor(HH[,grep("use_b_", names(HH))], use="complete.obs")
kable(print(corr_b))
alpha_b <- alpha(corr_b)
print(alpha_b[[1]]$std.alpha)
```
The overall alpha level is low, and from the correlation matrix, it appears that this is because of the last measure.
```{r}
alpha(HH[,c("use_b_1_situacion_1","use_b_2_situacion_2")])[[1]]$std.alpha
```
Still only get a modest alpha, so while correlated, not *very* strongly so. We can also look at PCA:
```{r}
pc_use_b <- prcomp(HH[,grep("use_b_", names(HH))], center=TRUE, scale=TRUE)
kable(summary(pc_use_b)[[2]])
kable(summary(pc_use_b)[[6]])
```
Again, the indication is pretty clear that the participation variable (B3) stands out from the other two.
Check how things differ for leaders versus non-leaders.
```{r echo=F}
kable(as.data.frame(crossTab(HH[,"use_b_1_situacion_1"], HH$leader,
"B.1", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH[,"use_b_2_situacion_2"], HH$leader,
"B.2", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH[,"use_b_3_participacion"], HH$leader,
"B.3", "Leader")[[2]]))
```
For the two attitudinal questions, (B1 and B2), not much difference, but pretty pronounced difference when it comes to participation.
That said, here is what I would propose: we can do an omnibus test for the whole module using ICW, which would upweight participation relative to the other two. But then we also want to look at the item-specific effects, where for the latter, we are particularly interested in effects on leaders for participation.
We create the ICW index and view the results, including how things look different for non-leaders and leaders:
```{r, echo=F, fig.dim = c(5,5)}
HH$icw_use_b <- icwIndex(HH[,grep("use_b_", names(HH))])[[2]]
HH$sum_use_b <- apply(HH[,grep("use_b_", names(HH))], 1, sum)
hist(HH$icw_use_b, main="Index of access and \n responsiveness perceptions")
par(mfrow=c(2,1), mar=c(3,3,3,3))
hist(HH$icw_use_b[HH$leader==0], freq=F, main="Non-leaders")
hist(HH$icw_use_b[HH$leader==1], freq=F, main="Leaders")
```
### Estimating treatment effects
#### Omnibus test for B module
```{r echo=F}
te_icw_b <- fitR("icw_use_b", "Access & Responsiveness (ICW)")
te_sum_b <- fitR("sum_use_b", "Access & Responsiveness (sum)")
lapply(lapply(list(te_icw_b, te_sum_b), resVec), kable)
```
#### Item level tests
```{r}
te_b1 <- fitR("use_b_1_situacion_1", "B1. Procedures")
te_b2 <- fitR("use_b_2_situacion_2", "B2. Non-favoritism")
te_b3 <- fitR("use_b_3_participacion", "B3. Engagement")
lapply(lapply(list(te_b1, te_b2, te_b3), resVec), kable)
```
### Upshot
* Need something that measures producer participation with finer gradation. E.g., could ask about participation within their organization. Because at the muni level there is not much going on.
* For vignette, instead of broken bridge, maybe something that has to do with agricultural extension.
* We also have the following on the analysis plan: "mayors' sense that they are either constrained or empowered by the planning process." This will require acquisition of data on mayors.
## Engagement with Development Institutions (C)
The first question here was whether the subjects had any knowledge of the district development councils, then for those said yes, it was followed up with a question about whether there was a "producers' rountable". Given the large number of no's on the first question, the second one is not so useful.
The next two batteries ask about meetings between either oneself (`_c_3_`) or one's producer organization (`_c_4_`) with various municipal or national officials.
Then last few (`_c_5_` to `_c_8_`) as about participation in the FECOPROD, CIRD, and then any other NGO activities.
```{r}
print(dfSummary(HH[,grep("_c_", names(HH))]), method="render")
```
### Knowledge of District Councils
Clean up and do a sanity check by seeing if leaders are more likely to know about the council:
```{r, echo=F}
HH$use_c_1_consejo_distrito <- as.numeric(HH["_c_1_consejo_distrito"]==1)
HH$use_c_1_consejo_distrito[is.na(HH$use_c_1_consejo_distrito)] <- 0
leader_dis_coun <- 100*round(mean(subset(HH, leader==1)$use_c_1_consejo_distrito), 2)
print(kable(as.data.frame(crossTab(HH$use_c_1_consejo_distrito, HH$leader, "Know of council","Leader")[[2]])))
```
We see that yes, leaders were more likely to know, but still only a minority (`r leader_dis_coun`%) did.
Curious as to whether this varies by district:
- Non-leader households:
```{r, echo=F}
print(with(subset(HH, leader==0),
kable(as.data.frame(cbind(tapply(use_c_1_consejo_distrito, distrito, function(x){round(mean(x),2)}),
table(distrito))))))
```
- Leader:
```{r, echo=F}
print(with(subset(HH, leader==1),
kable(as.data.frame(cbind(tapply(use_c_1_consejo_distrito, distrito, function(x){round(mean(x),2)}),
table(distrito))))))
```
Let's look at how levels of leaders' versus households' awareness relate within municipalities:
```{r, echo=F}
par(pty="s")
plot(with(subset(HH, leader==0), tapply(use_c_1_consejo_distrito, distrito, mean)),
with(subset(HH, leader==1), tapply(use_c_1_consejo_distrito, distrito, mean)),
xlab="Mean awareness (HH)", ylab="Mean awareness (Ldr)",
xlim=c(0,1), ylim=c(0,1))
abline(a=0, b=1, lty="dashed")
```
Generally leaders are more aware, but such awareness is not ubiquitous among leaders.
Given this low level of knowledge, not so interesting to look at knowledge of producers' roundtables per se. Nonetheless, FWIW:
```{r, echo=F}
HH$use_c_2_mesa_produccion <- as.numeric(HH["_c_2_mesa_produccion"]==1)
HH$use_c_2_mesa_produccion[is.na(HH$use_c_2_mesa_produccion)] <- 0
kable(as.data.frame(crossTab(HH$use_c_2_mesa_produccion, HH$leader,"Aware of Roundtable","Leader")[[2]]))
```
We can create an index that scores people in terms of how many of these things they can confirm as being in existence:
```{r, echo=F}
HH$use_c_1and2 <- HH$use_c_1_consejo_distrito + HH$use_c_2_mesa_produccion
kable(as.data.frame(crossTab(HH$use_c_1and2, HH$leader,"Knowledge score","Leader")[[2]]))
```
### Individual and organization meetings with development officials
```{r, echo=F}
for(i in 1:7){
HH[paste0("use_c_3_reunion_",i)] <- makeBinary(paste0("_c_3_reunion_",i), HH, 1)
HH[paste0("use_c_4_reunion_",i)] <- makeBinary(paste0("_c_4_reunion_",i), HH, 1)
}
indiv_meet_tab <- cbind(apply(subset(HH, leader==0)[grep("use_c_3_reunion_", names(HH))],
2,
mean),
apply(subset(HH, leader==1)[grep("use_c_3_reunion_", names(HH))],
2,
mean))
org_meet_tab <- cbind(apply(subset(HH, leader==0)[grep("use_c_4_reunion_", names(HH))],
2,
mean),
apply(subset(HH, leader==1)[grep("use_c_4_reunion_", names(HH))],
2,
mean))
colnames(indiv_meet_tab) <- colnames(org_meet_tab) <- c("Non-ldr.", "Ldr.")
rownames(indiv_meet_tab) <- rownames(org_meet_tab) <- c("Mayor",
"Sec. prod.",
"Prod. roundtable",
"Dist. devt. counc.",
"Min. Agr. Livst.",
"Min. Pub. Works",
"Min. Industry")
```
Here is how HH respondents reported their own meetings:
```{r, echo=F}
print(kable(round(indiv_meet_tab, 2)))
```
And how they reported whether their producers organization met:
```{r, echo=F}
print(kable(round(org_meet_tab, 2)))
```
Leaders obviously meet, themselves, at a much higher rate. Leaders and non-leaders have a similar understanding of the extent to which their organizations met. This is good, as it is indicative of there being communication between leaders and members. This, combined with the higher rates of meeting among leaders, is indicative of a proper representation relationship.
We can create an index of activity, that just adds all indicators together:
```{r, echo=F, fig.dim=c(5,5)}
HH$use_c_3_reunionsum <- apply(HH[grep("use_c_3_reunion_", names(HH))],
1,
sum)
HH$use_c_4_reunionsum <- apply(HH[grep("use_c_4_reunion_", names(HH))],
1,
sum)
breaksUp <- seq(from=-.5, to=7.5, by=1)
par(mfrow=c(1,2))
hist(subset(HH, leader==0)$use_c_3_reunionsum,
breaks=breaksUp,
main="Indiv. meeting \n activity (non-ldr.)",
xlab="Activity index")
hist(subset(HH, leader==1)$use_c_3_reunionsum,
breaks=breaksUp,
main="Indiv. meeting \n activity (ldr.)",
xlab="Activity index")
par(mfrow=c(1,2))
hist(subset(HH, leader==0)$use_c_4_reunionsum,
breaks=breaksUp,
main="Org. meeting \n activity (non-ldr.)",
xlab="Activity index")
hist(subset(HH, leader==1)$use_c_4_reunionsum,
breaks=breaksUp,
main="Org. meeting \n activity (ldr.)",
xlab="Activity index")
```
### NGO activity participation
These ask about whether the respondent participated (not whether the organization participated).
```{r, echo=F}
HH["use_c_5_fecoprod"] <- makeBinary("_c_5_fecoprod", HH, 1)
HH["use_c_6_cird"] <- makeBinary("_c_6_cird", HH, 1)
HH["use_c_7_ong"] <- makeBinary("_c_7_ong", HH, 1)
ngo_tab <- cbind(apply(subset(HH, leader==0)[c("use_c_5_fecoprod", "use_c_6_cird","use_c_7_ong")],
2,
mean),
apply(subset(HH, leader==1)[c("use_c_5_fecoprod", "use_c_6_cird","use_c_7_ong")],
2,
mean))
colnames(ngo_tab) <- c("Non-ldr.","Ldr.")
rownames(ngo_tab) <- c("FECOPROD","CIRD","Other NGO")
kable(round(ngo_tab, 2))
```
### Treatment effects
```{r, echo=F}
te_c1 <- fitR("use_c_1_consejo_distrito", "C1. Know of council")
te_c2 <- fitR("use_c_2_mesa_produccion", "C2. Know of roundtable")
te_c1and2 <- fitR("use_c_1and2", "C1/C2. Know of council/roundtable")
te_c3 <- fitR("use_c_3_reunionsum", "C3. Activities w/ dev. ofcl.")
te_c3_1 <- fitR("use_c_3_reunion_1", "C3. Meet w/ Mayor")
te_c3_2 <- fitR("use_c_3_reunion_2", "C3. Meet w/ Sec. prod.")
te_c3_3 <- fitR("use_c_3_reunion_3", "C3. Meet w/ Prod. rndtble.")
te_c3_4 <- fitR("use_c_3_reunion_4", "C3. Meet w/ Dist. dev. cncl.")
te_c3_5 <- fitR("use_c_3_reunion_5", "C3. Meet w/ Min. Agr. Livst.")
te_c3_6 <- fitR("use_c_3_reunion_6", "C3. Meet w/ Min. Pub. Works")
te_c3_7 <- fitR("use_c_3_reunion_7", "C3. Meet w/ Min. Industry")
te_c4 <- fitR("use_c_4_reunionsum", "C4. Org. activities w/ dev. ofcl.")
te_c4_1 <- fitR("use_c_4_reunion_1", "C4. Org meet w/ Mayor")
te_c4_2 <- fitR("use_c_4_reunion_2", "C4. Org meet w/ Sec. prod.")
te_c4_3 <- fitR("use_c_4_reunion_3", "C4. Org meet w/ Prod. rndtble.")
te_c4_4 <- fitR("use_c_4_reunion_4", "C4. Org meet w/ Dist. dev. cncl.")
te_c4_5 <- fitR("use_c_4_reunion_5", "C4. Org meet w/ Min. Agr. Livst.")
te_c4_6 <- fitR("use_c_4_reunion_6", "C4. Org meet w/ Min. Pub. Works")
te_c4_7 <- fitR("use_c_4_reunion_7", "C4. Org meet w/ Min. Industry")
te_c5 <- fitR("use_c_5_fecoprod", "C5. FECOPROD part.")
te_c6 <- fitR("use_c_6_cird", "C6. CIRD part.")
te_c7 <- fitR("use_c_7_ong", "C7. Other NGO part.")
lapply(lapply(list(te_c1,
te_c2,
te_c1and2,
te_c3,
te_c3_1,
te_c3_2,
te_c3_3,
te_c3_4,
te_c3_5,
te_c3_6,
te_c3_7,
te_c4_1,
te_c4_2,
te_c4_3,
te_c4_4,
te_c4_5,
te_c4_6,
te_c4_7,
te_c4,
te_c5,
te_c6,
te_c7),
resVec), kable)
```
Not sure why the CIRD variable is not quite checking out. Let's look at the district means of that variable:
```{r, echo=F}
cird_dist_tab <- cbind(
tapply(subset(HH, leader==0)$treated,
subset(HH, leader==0)$distrito,
mean),
round(tapply(subset(HH, leader==0)$use_c_6_cird,
subset(HH, leader==0)$distrito,
mean),2),
table(subset(HH, leader==0)$distrito),
tapply(subset(HH, leader==1)$treated,
subset(HH, leader==1)$distrito,
mean),
round(tapply(subset(HH, leader==1)$use_c_6_cird,
subset(HH, leader==1)$distrito,
mean),2),
table(subset(HH, leader==1)$distrito)
)
colnames(cird_dist_tab) <- c("Non ldr.: Treated",
"CIRD",
"N",
"Ldr.: Treated",
"CIRD",
"N")
kable(cird_dist_tab)
```
So seems like there is lots of noise here. Need something better by way of a direct manipulation check with respect to CIRD per se, although we do see increases in meeting with dev't council and production roundtable, which are quite specific to the intervention. Maybe this is something about the way that CIRD worked, to fly sort of under the radar??
### Upshot
Measurement of engagement with municipal and national officials seems to be working. We need a better way to capture engagement with CIRD though.
## Perception that municipal planning process is fair and open (D)
Now we turn to module D, which focuses on producers' perceptions as to whether the municipal development planning process is fair and open.
```{r}
print(dfSummary(HH[,grep("_d_", names(HH))]), method="render")
```
### Awareness of the plan
First indicator is simply awareness of a district development plan:
```{r, echo=F}
HH["use_d_1_plan_desarrollo"] <- makeBinary("_d_1_plan_desarrollo", HH, 1)
kable(as.data.frame(crossTab(HH$use_d_1_plan_desarrollo, HH$leader, "Know of plan", "Leader")[[2]]))
```
Pretty low awareness, even among leaders. So this means that we won't get much information from the other questions.
### Plan priorities
These questions ask respondents who know about the plan what they thought the plan prioritized.
First are the open responses. These will need to be coded. But we can look:
```{r}
kable(table(HH[,"_d_2_objetivos_1"][HH[,"_d_2_objetivos_1"]!=""&HH[,"_d_2_objetivos_1"]!="no sabe"&HH[,"_d_2_objetivos_1"]!="No Sabe"&HH[,"_d_2_objetivos_1"]!="Ns"&HH[,"_d_2_objetivos_1"]!="NS"&HH[,"_d_2_objetivos_1"]!="No sabe"]))
kable(table(HH[,"_d_2_objetivos_2"][HH[,"_d_2_objetivos_2"]!=""&HH[,"_d_2_objetivos_2"]!="no sabe"&HH[,"_d_2_objetivos_2"]!="No Sabe"&HH[,"_d_2_objetivos_2"]!="Ns"&HH[,"_d_2_objetivos_2"]!="NS"&HH[,"_d_2_objetivos_2"]!="Na sabe"&HH[,"_d_2_objetivos_2"]!="No"&HH[,"_d_2_objetivos_2"]!="No sab"&HH[,"_d_2_objetivos_2"]!="No sab3"&HH[,"_d_2_objetivos_2"]!="No sabe"&HH[,"_d_2_objetivos_2"]!="No sabe otro"&HH[,"_d_2_objetivos_2"]!="Nosabe"&HH[,"_d_2_objetivos_2"]!="Ya no sabe"]))
```
Now we ask about whether the plans specifically included roads, extension services, or other support to small producers:
```{r}
for(i in 1:3){
HH[,paste0("use_d_3_incluidos_",i)] <- makeBinary(paste0("_d_3_incluidos_",i),HH,1)
}
kable(as.data.frame(crossTab(HH$use_d_3_incluidos_1, HH$leader, "Plan has roads", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_d_3_incluidos_2, HH$leader, "Plan extn. srvcs.", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_d_3_incluidos_3, HH$leader, "Plan has other support", "Leader")[[2]]))
```
We can construct an index that measures the extent to which respondents understood the plans to incorporate these three things, which we learned in the baseline to be important for small producers. This would be an index measuring something like "the extent to which respondent thinks the plan is addressing producers' needs":
```{r echo=F}
HH$use_d_3_sum <- HH$use_d_3_incluidos_1+HH$use_d_3_incluidos_2+HH$use_d_3_incluidos_3
kable(as.data.frame(crossTab(HH$use_d_3_sum, HH$leader, "Aware that plan addresses needs index", "Leader")[[2]]))
```
### Participation in the plan
```{r echo=F}
HH$use_d_4_participacion <- makeBinary("_d_4_participacion",HH,1)
HH$use_d_5_part_creacion <- makeBinary("_d_5_part_creacion",HH,1)
kable(as.data.frame(crossTab(HH$use_d_4_participacion, HH$leader, "Part. in plan", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_d_5_part_creacion, HH$leader, "Org. part. in plan", "Leader")[[2]]))
```
### Perception that district development plan attends to producers' interests
```{r}
HH$use_d_6_expresar_prioridades_rev <- revCleanLik(HH[,"_d_6_expresar_prioridades"])
HH$use_d_7_expresar_prioridades_rev <- revCleanLik(HH[,"_d_7_expresar_prioridades"])
HH$use_d_8_provisions_rev <- revCleanLik(HH[,"_d_8_provision"])
HH$use_d_9_prioridades_rev <- revCleanLik(HH[,"_d_9_prioridades"])
kable(as.data.frame(crossTab(HH$use_d_6_expresar_prioridades_rev, HH$leader, "Plan lets producers express", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_d_7_expresar_prioridades_rev, HH$leader, "Plan lets your org. express", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_d_8_provisions_rev, HH$leader, "Plan will improve services", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_d_9_prioridades_rev, HH$leader, "Budget reflects priorities", "Leader")[[2]]))
```
We can make an index that adds all of these to make an index of extent to which they can affirm that the planning attends to their and producers' needs:
```{r}
HH$use_d_6to9_sum <- HH$use_d_6_expresar_prioridades_rev + HH$use_d_7_expresar_prioridades_rev + HH$use_d_8_provisions_rev + HH$use_d_9_prioridades_rev
```
### Perception that muncipal planning generally attends to producers' interests
```{r, echo=F}
HH$use_d_10_gasto_municipal_rev <- revCleanLik(HH[,"_d_10_gasto_municipal"])
kable(as.data.frame(crossTab(HH$use_d_10_gasto_municipal_rev, HH$leader, "Planning attends to prod.", "Leader")[[2]]))
```
### Treatment effects
```{r}
te_d1 <- fitR("use_d_1_plan_desarrollo", "D1. Aware of plan")
te_d3 <- fitR("use_d_3_sum", "D3. Affirm plan addresses spec. needs")
te_d4 <- fitR("use_d_4_participacion", "D4. Part. in planning")
te_d5 <- fitR("use_d_5_part_creacion", "D5. Org. part. in planning")
te_d6to9 <- fitR("use_d_6to9_sum", "D6 to D9. Plan attends to needs")
te_d10 <- fitR("use_d_10_gasto_municipal_rev", "D10. Muni. attends to needs")
lapply(lapply(list(te_d1,
te_d3,
te_d4,
te_d5,
te_d6to9,
te_d10),
resVec), kable)
```
### Upshot
Need to measure access and fairness perceptions in a way that does not condition on people's awareness of the plan per se.
# Institutionalizing buyer-municipality-producer interaction (E)
These questions get at whether any new action vis-a-vis buyers was instigated.
```{r}
print(dfSummary(HH[,grep("_e_", names(HH))]), method="render")
```
Knowing now the nature of the intervention, not sure why we would think there would be effects here. We will look here just to see if there is a need to keep a whole battery on this.
```{r echo=F}
HH$use_e_1_participacion_1 <- makeBinary("_e_1_participacion_1", HH, 1)
HH$use_e_1_participacion_2 <- makeBinary("_e_1_participacion_2", HH, 1)
HH$use_e_1_participacion_3 <- makeBinary("_e_1_participacion_3", HH, 1)
HH$use_e_2_ayudas <- makeBinary("_e_2_ayudas", HH, 1)
kable(as.data.frame(crossTab(HH$use_e_1_participacion_1, HH$leader, "Meet new buyers", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_e_1_participacion_2, HH$leader, "Neg. new contracts", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_e_1_participacion_3, HH$leader, "Meet muni. auth. re. buyers", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_e_2_ayudas, HH$leader, "Muni. auth. help w/ contracts", "Leader")[[2]]))
HH$use_e_sum <- HH$use_e_1_participacion_1+HH$use_e_1_participacion_2+HH$use_e_1_participacion_3+HH$use_e_2_ayudas
te_esum <- fitR("use_e_sum", "E sum. Buying opport. index")
te_e1 <- fitR("use_e_1_participacion_1", "E1. Meet new buyers")
te_e2 <- fitR("use_e_1_participacion_2", "E2. Neg. new contracts")
te_e3 <- fitR("use_e_1_participacion_3", "E3. Meet muni. auth. re. buyers")
te_e4 <- fitR("use_e_2_ayudas", "E4. Muni. auth. help w/ contracts")
lapply(lapply(list(te_esum,
te_e1,
te_e2,
te_e3,
te_e4),
resVec), kable)
```
Suprisingly, there is indication of an effect.
## Upshot
Need to look into why we would be seeing these effects. Add an open response -- for someone who said yes to any of the items, ask what the meetings were about.
# Distribution of services by mayors and the municipality (F)
To study whether mayors and municipalities target producers' needs, we focus on roads and transport, electricity, and technical assistance such as extension services. These are top priorities for producers in terms of the their demand for services from the municipality, as per our pre-intervention study on producers' needs and preferences.
## Roads and transport
The data include the section "F" questions in the HH data as well as the transport roster.
```{r}
print(dfSummary(HH[,grep("_f_", names(HH))]), method="render")
```
### Use freight service
First question asks whether producer transported products "using any freight service"? The wording here seems problematic because producers may not have known what we meant by "freight service":
```{r, echo=FALSE}
HH$use_f_1_transporte_prod <- makeBinary("_f_1_transporte_prod", HH, 1)
kable(as.data.frame(crossTab(HH$use_f_1_transporte_prod, HH$leader, "Used freight service", "Leader")[[2]]))
```
We see that even here leaders are more active.
The following questions are then conditional on answering yes to the first, so we have lots of missing data. Again, this was a mistake. For what it's worth we can go through the others.
### Severity of problems with transport
```{r, echo=FALSE}
HH$use_f_2_frec_problemas_lluvia <- HH[,"_f_2_frec_problemas_lluvia"]
HH$use_f_2_frec_problemas_lluvia[is.na(HH$use_f_2_frec_problemas_lluvia)] <- 0
HH$use_f_2_frec_problemas_lluvia[HH$use_f_2_frec_problemas_lluvia==99] <- 0
HH$use_f_3_frec_problemas_nolluvia <- HH[,"_f_3_frec_problemas_nolluvia"]
HH$use_f_3_frec_problemas_nolluvia[is.na(HH$use_f_3_frec_problemas_nolluvia )] <- 0
HH$use_f_3_frec_problemas_nolluvia[HH$use_f_3_frec_problemas_nolluvia==99] <- 0
HH$use_f_2_and_f_3 <- apply(cbind(HH$use_f_2_frec_problemas_lluvia,
HH$use_f_3_frec_problemas_nolluvia),
1,
mean)
kable(as.data.frame(crossTab(HH$use_f_2_frec_problemas_lluvia, HH$leader, "Severity of transport problems, rainy", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_f_3_frec_problemas_nolluvia, HH$leader, "Severity of transport problems, non-rainy", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_f_2_and_f_3, HH$leader, "Severity of transport problems, avg. of rainy/non-rainy", "Leader")[[2]]))
```
### Transport costs
Here we need to work with the transport roster and then merge the information back into the HH dataset.
```{r, echo=FALSE}
print(dfSummary(transport, method="render"))
```
So we have data on the following, with comments on how we might analyze:
* Products transported and their quantity. Not sure how we can use this for effects, although we can use it for descriptive purposes.
* How far the product was transported. Again not sure how to use this, since effects could go either up (if there was transporting to more distant markets happening) or down (if new roads shorten the distance). Nonetheless, we could use it for descriptive purposes.
* Total amount spent on transport. Again not sure how to use this, since effects could go either up (if there was more transporting happening) or down (if the only effect is on costs and not volume). Nonetheless, we could use it for descriptive purposes.
* Whether there were any losses. This one seems good, although we should not that losses could go up if there was more volume. So need to account for effects on volume. Should be asked of everyone!!!
* Value of losses. Again seems good, although we should not that losses could go up if there was more volume. So need to account for effects on volume. Should be asked of everyone!!!
* Road improvements -- seems good. Should be asked of everyone!!!
NB: The following tables and histograms use the row in the roster as the unit of analysis. So this corresponds to each *product* listed, and so some HH appear more than once.
#### Products transported
```{r, echo=FALSE}
kable(table(transport[,"_f_4_prod_"]))
```
#### Distances transported
```{r, echo=FALSE}
transport$use_f_6_distancia <- transport[,"_f_6_distancia"]
transport$use_f_6_distancia[transport[,"_f_6_distancia"]==-99] <- mean(transport$use_f_6_distancia[transport[,"_f_6_distancia"]!=99])
transport$use_f_6_distancia[transport[,"_f_6_distancia"]>500] <- transport$use_f_6_distancia[transport[,"_f_6_distancia"]>500]/1000
hist(transport$use_f_6_distancia)
```
#### Transport expenditures
```{r, echo=FALSE}
transport$use_f_7_gastos <- transport[,"_f_7_gastos"]
transport$use_f_7_gastos[is.na(transport[,"_f_7_gastos"])] <- 0
transport$use_f_7_gastos[transport[,"_f_7_gastos"]==-99] <- mean(transport$use_f_7_gastos[transport[,"_f_7_gastos"]!=99])
hist(transport$use_f_7_gastos)
transport$use_f_7_gastos_log <- log(transport$use_f_7_gastos+1)
hist(transport$use_f_7_gastos_log)
```
#### Any losses
```{r, echo=FALSE}
transport$use_f_8_perdidas <- makeBinary("_f_8_perdidas", transport, 1)
kable(table(transport$use_f_8_perdidas))
```
#### Value of losses
```{r, echo=FALSE}
transport$use_f_9_perdidas_cantidad <- transport[,"_f_9_perdidas_cantidad"]
transport$use_f_9_perdidas_cantidad[is.na(transport[,"_f_9_perdidas_cantidad"])] <- 0
transport$use_f_9_perdidas_cantidad[transport[,"_f_9_perdidas_cantidad"]==-99] <- mean(transport$use_f_9_perdidas_cantidad[transport[,"_f_9_perdidas_cantidad"]!=99])
hist(transport$use_f_9_perdidas_cantidad)
transport$use_f_9_perdidas_cantidad_log <- log(transport$use_f_9_perdidas_cantidad+1)
hist(transport$use_f_9_perdidas_cantidad_log)
par(pty="s")
plotRange <- range(na.omit(c(transport$use_f_7_gastos_log, transport$use_f_9_perdidas_cantidad_log)))
plot(transport$use_f_7_gastos_log,
transport$use_f_9_perdidas_cantidad_log,
xlim=plotRange,
ylim=plotRange)
abline(a=0, b=1)
```
#### Any improvements
```{r}
transport$use_f_10_mejoras <- makeBinary("_f_10_mejoras", transport, 1)
kable(table(transport$use_f_10_mejoras))
```
#### Aggregated roster data merged with HH
```{r, echo=FALSE}
transport_collapse <- summaryBy(use_f_6_distancia +
use_f_7_gastos +
use_f_8_perdidas +
use_f_9_perdidas_cantidad +
use_f_10_mejoras ~ parent_key,
FUN=c(sum,max), data=transport)
HH <- merge(HH, transport_collapse,
by.x = "key",
by.y = "parent_key",
all.x=TRUE,
sort=TRUE)
for(varUp in c("use_f_6_distancia.sum",
"use_f_7_gastos.sum",
"use_f_8_perdidas.max",
"use_f_9_perdidas_cantidad.sum",
"use_f_10_mejoras.max")){
HH[,varUp][is.na(HH[,varUp])] <- 0
}
hist(HH$use_f_6_distancia.sum)
hist(HH$use_f_7_gastos.sum)
HH$use_f_7_gastos.sum_log <- log(HH$use_f_7_gastos.sum+1)
hist(HH$use_f_7_gastos.sum_log)
kable(as.data.frame(crossTab(HH$use_f_8_perdidas.max, HH$leader, "Any losses", "Leader")[[2]]))
hist(HH$use_f_9_perdidas_cantidad.sum)
HH$use_f_9_perdidas_cantidad.sum_log <- log(HH$use_f_9_perdidas_cantidad.sum+1)
hist(HH$use_f_9_perdidas_cantidad.sum_log)
kable(as.data.frame(crossTab(HH$use_f_10_mejoras.max, HH$leader, "Any transport improvements", "Leader")[[2]]))
```
#### Treatment effects for module F
```{r, echo=FALSE}
te_f1 <- fitR("use_f_1_transporte_prod", "F1. Use freight service")
te_f2_and_f3 <- fitR("use_f_2_and_f_3", "F2 and F3. Severity of problems")
te_f6 <- fitR("use_f_6_distancia.sum", "F6. Transport distance")
te_f7 <- fitR("use_f_7_gastos.sum_log", "F7. Transport costs (log)")
te_f8 <- fitR("use_f_8_perdidas.max", "F8. Any losses")
te_f9 <- fitR("use_f_9_perdidas_cantidad.sum_log", "F9. Cost of losses (log)")
te_f10 <- fitR("use_f_10_mejoras.max", "F10. Any improvements")
lapply(lapply(list(te_f1,
te_f2_and_f3,
te_f6,
te_f7,
te_f8,
te_f9,
te_f10),
resVec), kable)
```
Maybe there is something here, e.g., with respect to severity of problems, costs, and incidence of losses. There is a weird negative effect on use of freight services for leaders, which again points to the potentially problematic nature of the question. But with all the zero entries (due to people answering no on the first question), we just don't have much to work with. Need to redesign this so that we don't screen out 80% of respondents on the basis of a question that may have been misunderstood.
## Quality of Road and Electricity Services (G)
```{r}
print(dfSummary(HH[,grep("_g_", names(HH))]), method="render")
```
We now turn to module G, which asks about perceived quality of roads and electricity, as provided by the municipality:
### Roads
#### Descriptives
We have:
* g1: Quality of nearest road (paved=1, dirt=5).
* g2: When were the last improvements. Here we code to the month that is at the midpoint of the ranges available, where for the last one ("more than 2 years") we code to 30 months.
* g3: Time to municipal center (minutes)
* g4: Time to the nearest paved road (minutes)
* g6: Knowledge of plan to improve road
```{r, echo=FALSE}
HH$use_g_1_estado_camino <- HH[,"_g_1_estado_camino"]
HH$use_g_1_estado_camino[is.na(HH[,"_g_1_estado_camino"])] <- median(HH$use_g_1_estado_camino[!is.na(HH[,"_g_1_estado_camino"])])
HH$use_g_1_estado_camino[HH[,"_g_1_estado_camino"]==99] <- median(HH$use_g_1_estado_camino[!is.na(HH[,"_g_1_estado_camino"])])
HH$use_g_1_estado_camino[HH[,"_g_1_estado_camino"]==98] <- median(HH$use_g_1_estado_camino[!is.na(HH[,"_g_1_estado_camino"])])
kable(as.data.frame(crossTab(HH$use_g_1_estado_camino, HH$leader, "Quality of nearest road (paved=1, dirt=5)", "Leader")[[2]]))
```
```{r, echo=FALSE}
HH$use_g_2_tiempo_mejora <- NA
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora"]==1] <- .5
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora"]==2] <- 7
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora"]==3] <- 18
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora"]==4] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "1"] <- 12
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "10 año"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "10 años"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "12 años"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "15 año"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "15 años"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "2 año"] <- 24
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "20 años"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "3 años"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "4 meses"] <- 4
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "5 meses"] <- 5
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "6 año"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "6 meses"] <- 6
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "7 años"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "7 meses"] <- 7
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "8 años"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "8 mese"] <- 8
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "8 meses"] <- 8
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "9 meses"] <- 9
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "Actualmente está haciendo mejora"] <- .5
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "Aún no se está terminando las mejoras"] <- .5
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "Cada votación"] <- 18
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "El asfaltado no necesita reparaciónes"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "No reparo nunca desde que se inauguro"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "No se arreagla."] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "No se hizo ningun trabajo"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "Nunca"] <- 30
HH$use_g_2_tiempo_mejora[HH[,"_g_2_tiempo_mejora_otro"] == "Nunca se arreglo"] <- 30
HH$use_g_2_tiempo_mejora[is.na(HH$use_g_2_tiempo_mejora)] <- median(HH$use_g_2_tiempo_mejora[!is.na(HH$use_g_2_tiempo_mejora)])
hist(HH$use_g_2_tiempo_mejora)
```
```{r, echo=FALSE}
# g3
HH$use_g_3_epoca_lluvia_hr <- cleanNeg99mean("_g_3_epoca_lluvia_hr")
HH$use_g_3_epoca_lluvia_min <- cleanNeg99mean("_g_3_epoca_lluvia_min")
HH$use_g_3_epoca_lluvia_min_com <- HH$use_g_3_epoca_lluvia_min + 60*HH$use_g_3_epoca_lluvia_hr
HH$use_g_3_epoca_sin_lluvia_hr <- cleanNeg99mean("_g_3_epoca_sin_lluvia_hr")
HH$use_g_3_epoca_sin_lluvia_min <- cleanNeg99mean("_g_3_epoca_sin_lluvia_min")
HH$use_g_3_epoca_sin_lluvia_min_com <- HH$use_g_3_epoca_sin_lluvia_min + 60*HH$use_g_3_epoca_sin_lluvia_hr
HH$use_g_3_combined <- apply(cbind(HH$use_g_3_epoca_lluvia_min_com,
HH$use_g_3_epoca_sin_lluvia_min_com),
1,
mean)
hist(HH$use_g_3_combined)
```
```{r, echo=FALSE}
# g4
HH$use_g_4_epoca_lluvia_hr <- cleanNeg99mean("_g_4_epoca_lluvia_hr")
HH$use_g_4_epoca_lluvia_min <- cleanNeg99mean("_g_4_epoca_lluvia_min")
HH$use_g_4_epoca_lluvia_min_com <- HH$use_g_4_epoca_lluvia_min + 60*HH$use_g_4_epoca_lluvia_hr
HH$use_g_4_epoca_sin_lluvia_hr <- cleanNeg99mean("_g_4_epoca_sin_lluvia_hr")
HH$use_g_4_epoca_sin_lluvia_min <- cleanNeg99mean("_g_4_epoca_sin_lluvia_min")
HH$use_g_4_epoca_sin_lluvia_min_com <- HH$use_g_4_epoca_sin_lluvia_min + 60*HH$use_g_4_epoca_sin_lluvia_hr
HH$use_g_4_combined <- apply(cbind(HH$use_g_4_epoca_lluvia_min_com,
HH$use_g_4_epoca_sin_lluvia_min_com),
1,
mean)
hist(HH$use_g_4_combined)
```
```{r, echo=FALSE}
# g6
HH$use_g_6_plan_mejora <- makeBinary("_g_6_plan_mejora", HH, 1)
kable(as.data.frame(crossTab(HH$use_g_6_plan_mejora, HH$leader, "Know of plan for road improvement", "Leader")[[2]]))
```
#### Create an index that aggregates all of this
We use principal components.
```{r, echo=FALSE}
gr_1_to_6_mat <- HH[,c("use_g_1_estado_camino",
"use_g_2_tiempo_mejora",
"use_g_3_combined",
"use_g_4_combined",
"use_g_6_plan_mejora")]
cor(gr_1_to_6_mat)
prcomp_g_1_to_6 <- prcomp(gr_1_to_6_mat, center=TRUE, scale=TRUE)
kable(summary(prcomp_g_1_to_6)[[2]])
kable(summary(prcomp_g_1_to_6)[[6]])
HH$use_g_1_to_6_prcomp <- predict(prcomp_g_1_to_6)[,1]
```
Useful to view this principal components analysis, because it shows that *time since last repair* and *belief that there are plans for repair* are negatively correlated, and so there is the expectation that places that have been neglected are indeed slated for repair.
#### Treatment effects
```{r, echo=FALSE}
te_g1_to_6 <- fitR("use_g_1_to_6_prcomp", "G1 to G6. Road disrepair index")
te_g1 <- fitR("use_g_1_estado_camino", "G1. Quality of nearest road (rev. coded)")
te_g2 <- fitR("use_g_2_tiempo_mejora", "G2. Time since road improvements")
te_g3 <- fitR("use_g_3_combined", "G3. Time to muni center")
te_g4 <- fitR("use_g_4_combined", "G4. Time to paved road")
te_g6 <- fitR("use_g_6_plan_mejora", "G6. Know of road impr. plan")
lapply(lapply(list(te_g1_to_6,
te_g1,
te_g2,
te_g3,
te_g4,
te_g6),
resVec), kable)
```
#### Notes
These questions seem to work well, even if we are not seeing effects. Suggest keeping it as is.
### Electricity
We have:
* g8: house connected to electricity grid. There is almost no variation in this variable (99% say yes).
* g9: has three-phase current connection. Also very little variation here (93% say no).
* g10: any extension of grid in your muni
* g11: improvements in current quality
* g12: your production has benefited from electricity improvements
We can add g8 and g9 to get an index:
```{r, echo=FALSE}
HH$use_g_8_ande <- makeBinary("_g_8_ande", HH, 1)
HH$use_g_9_corriente <- makeBinary("_g_9_corriente", HH, 1)
HH$use_g8_plus_g9 <- HH$use_g_8_ande + HH$use_g_9_corriente
kable(as.data.frame(crossTab(HH$use_g8_plus_g9, HH$leader, "Electricity access index", "Leader")[[2]]))
```
```{r, echo=FALSE}
HH$use_g_10_extension_red <- makeBinary("_g_10_extension_red", HH, 1)
HH$use_g_11_calidad_corriente <- makeBinary("_g_11_calidad_corriente", HH, 1)
HH$use_g_12_beneficio <- makeBinary("_g_12_beneficio", HH, 1)
kable(as.data.frame(crossTab(HH$use_g_10_extension_red, HH$leader, "Recent elec. grid ext.", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_g_11_calidad_corriente, HH$leader, "Recent elec. current impr.", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_g_12_beneficio, HH$leader, "Prod. benefited from elec. improv.", "Leader")[[2]]))
gr_10_to_12_mat <- HH[,c("use_g_10_extension_red",
"use_g_11_calidad_corriente",
"use_g_12_beneficio")]
cor(gr_10_to_12_mat)
prcomp_g_10_to_12 <- prcomp(gr_10_to_12_mat, center=TRUE, scale=TRUE)
kable(summary(prcomp_g_10_to_12)[[2]])
kable(summary(prcomp_g_10_to_12)[[6]])
HH$use_gr_10_to_12_prcomp <- predict(prcomp_g_10_to_12)[,1]
te_g8_and_9 <- fitR("use_g8_plus_g9", "G8 and 9. Elec. access index")
te_g10_to_12 <- fitR("use_gr_10_to_12_prcomp", "G10 to 12. Elec. improve. index")
te_g10 <- fitR("use_g_10_extension_red", "G10. Elctrc. grid extend")
te_g11 <- fitR("use_g_11_calidad_corriente", "G11. Elctrc. improve current")
te_g12 <- fitR("use_g_12_beneficio", "G12. Elctrc. benefit fr. imprvmnt.")
lapply(lapply(list(te_g8_and_9,
te_g10_to_12,
te_g10,
te_g11,
te_g12),
resVec), kable)
```
#### Notes