-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathendline2-analysis.Rmd
1917 lines (1456 loc) · 78.6 KB
/
endline2-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 R2 Data Report"
author: "Cyrus Samii (modified by Antonella Bandiera)"
date: "9/2/2019-present"
output:
html_document:
df_print: paged
number_sections: yes
toc: yes
pdf_document:
toc: yes
html_notebook:
number_sections: yes
word_document:
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-r2`
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-r2/BASE DE DATOS E INFORMES FINALES/Finales/1_Base_de_datos_principal_14_08_2019.dta"))
roster <- as.data.frame(import("endline-data-r2/BASE DE DATOS E INFORMES FINALES/Finales/2_personas_14_08_2019.dta"))
#transport <- as.data.frame(import("endline-data-r1/Cargaas E+E/Finales/3_transporte_10_12_2018.dta")) This one is not in r2
lote_princ <- as.data.frame(import("endline-data-r2/BASE DE DATOS E INFORMES FINALES/Finales/3_lote_principal_14_08_2019.dta"))
lote_secun <- as.data.frame(import("endline-data-r2/BASE DE DATOS E INFORMES FINALES/Finales/4_lote_secundario_14_08_2019.dta"))
prod_pecu <- as.data.frame(import("endline-data-r2/BASE DE DATOS E INFORMES FINALES/Finales/5_produccion_pecuaria_14_08_2019.dta"))
prod_deri <- as.data.frame(import("endline-data-r2/BASE DE DATOS E INFORMES FINALES/Finales/6_productos_derivados_14_08_2019.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"])
design_d <- as.data.frame(sapply(design_d, toupper))
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[,"_9_lider_sino"]
HH$leader[is.na(HH[,"_9_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))]),style="grid",graph.magnif=0.75, 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 alpha level is still low, but better than in r1 (=0.4265548) probably because the correlation between b3 and the other questions is a bit higher.
```{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]]))
```
r1: For the two attitudinal questions, (B1 and B2), not much difference, but pretty pronounced difference when it comes to participation.
r2: the difference is not that pronounced.
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")
```
Look at how the index is less different between leaders and non-leaders in r2.
### Estimating treatment effects
#### Omnibus test for B module
Check the signs of the coefficients: in r1, all negative for non-leaders, while always positive in r2. For leader the only one that flipped is perception of favoritism.
```{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 (=1), it was followed up with a question about whether there was a "producers' rountable".
The next two batteries ask about meetings with the mayor (`_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)
```
Effect for CIRD is larger and significant in r2. Let's look at the district means of that variable:
```{r, echo=F}
HH$treated <- as.numeric(HH$treated)
HH$treated <- ifelse(HH$treated == 2, 1, 0)
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 less noisy than r1.
### 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 on Municipality Investments (D)
Now we turn to module D. In r1 D focused on producers' perceptions as to whether the municipal development planning process is fair and open. In r2, D focuses on producers' perceptions of municipality investments. I adapted this section to reflect answers to the new questions.
```{r}
print(dfSummary(HH[,grep("_d_", names(HH))]), method="render")
```
Below I don't replicate the code for r1, because questions are pretty different.
### Municipality 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_1_inversiones"][HH[,"_d_1_inversiones"]!=""&HH[,"_d_1_inversiones"]!="no sabe"&HH[,"_d_1_inversiones"]!="No Sabe"&HH[,"_d_1_inversiones"]!="Ns"&HH[,"_d_1_inversiones"]!="NS"&HH[,"_d_1_inversiones"]!="No sabe"]))
kable(table(HH[,"_d_1_inversiones"][HH[,"_d_1_inversiones"]!=""&HH[,"_d_1_inversiones"]!="no sabe"&HH[,"_d_1_inversiones"]!="No Sabe"&HH[,"_d_1_inversiones"]!="Ns"&HH[,"_d_1_inversiones"]!="NS"&HH[,"_d_1_inversiones"]!="Na sabe"&HH[,"_d_1_inversiones"]!="No"&HH[,"_d_1_inversiones"]!="No sab"&HH[,"_d_1_inversiones"]!="No sab3"&HH[,"_d_1_inversiones"]!="No sabe"&HH[,"_d_1_inversiones"]!="No sabe otro"&HH[,"_d_1_inversiones"]!="Nosabe"&HH[,"_d_1_inversiones"]!="Ya no sabe"]))
```
Now we ask about whether the municipality gave importance to maintaining roads, extension services, and support for producers.
```{r}
#Here I'm re coding 2 (yes, some) to 1, so that the make binary makes sense
HH$`_d_2_importancia_1`[HH$`_d_2_importancia_1`==2] <- 1
HH$`_d_2_importancia_2`[HH$`_d_2_importancia_2`==2] <- 1
HH$`_d_2_importancia_3`[HH$`_d_2_importancia_3`==2] <- 1
for(i in 1:3){
HH[,paste0("use_d_2_importancia_",i)] <- makeBinary(paste0("_d_2_importancia_",i),HH,1)
}
kable(as.data.frame(crossTab(HH$use_d_2_importancia_1, HH$leader, "Municipality gave importance to roads", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_d_2_importancia_2, HH$leader, "Municipality gave importance to extn. srvcs.", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_d_2_importancia_3, HH$leader, "Municipality gave importance to support", "Leader")[[2]]))
```
We can construct an index that measures the extent to which respondents think that the municipality is investing in these three things.
```{r echo=F}
HH$use_d_2_sum <- HH$use_d_2_importancia_1+HH$use_d_2_importancia_2+HH$use_d_2_importancia_3
kable(as.data.frame(crossTab(HH$use_d_2_sum, HH$leader, "Municipality invests index", "Leader")[[2]]))
```
### Perception that municipal spending attends to producers' interests
```{r}
HH$use_d3_piensa_necesidades <- revCleanLik(HH[,"_d3_piensa_necesidades"])
kable(as.data.frame(crossTab(HH$use_d3_piensa_necesidades, HH$leader, "Municipal spending attends needs", "Leader")[[2]]))
```
### Treatment effects
```{r}
te_d2 <- fitR("use_d_2_sum", "D2. Municipality gave importance ")
te_d3 <- fitR("use_d3_piensa_necesidades", "D3. Spending attends needs")
lapply(lapply(list(te_d2,
te_d3
),
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_1 <- makeBinary("_e_1_participacion_1_1", HH, 1)
HH$use_e_1_participacion_1_2 <- makeBinary("_e_1_participacion_1_2", HH, 1)
HH$use_e_1_participacion_1_3 <- makeBinary("_e_1_participacion_1_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_1, HH$leader, "Meet new buyers", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_e_1_participacion_1_2, HH$leader, "Neg. new contracts", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_e_1_participacion_1_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]]))
```
```{r echo=FALSE}
HH$use_e_sum <- HH$use_e_1_participacion_1_1+HH$use_e_1_participacion_1_2+HH$use_e_1_participacion_1_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_1", "E1. Meet new buyers")
te_e2 <- fitR("use_e_1_participacion_1_2", "E2. Neg. new contracts")
te_e3 <- fitR("use_e_1_participacion_1_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)
```
In r1 there was an effect; it is less clear that something is going on here howecer, except for
## 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")
```
The following questions ask about problems with transportation. There is no question here about freight service here (in r1 these questions were asked only if respondent answered yes to the freight service question).
### Severity of problems with transport
```{r, echo=FALSE}
HH$use_f_1_frec_problemas_lluvia <- HH[,"_f_1_frec_problemas_lluvia"]
HH$use_f_1_frec_problemas_lluvia[is.na(HH$use_f_1_frec_problemas_lluvia)] <- 0
HH$use_f_1_frec_problemas_lluvia[HH$use_f_1_frec_problemas_lluvia==99] <- 0
HH$use_f_2_frec_problemas_nolluvia <- HH[,"_f_2_frec_problemas_nolluvia"]
HH$use_f_2_frec_problemas_nolluvia[is.na(HH$use_f_2_frec_problemas_nolluvia )] <- 0
HH$use_f_2_frec_problemas_nolluvia[HH$use_f_2_frec_problemas_nolluvia==99] <- 0
HH$use_f_1_and_f_2 <- apply(cbind(HH$use_f_1_frec_problemas_lluvia,
HH$use_f_2_frec_problemas_nolluvia),
1,
mean)
kable(as.data.frame(crossTab(HH$use_f_1_frec_problemas_lluvia, HH$leader, "Severity of transport problems, rainy", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_f_2_frec_problemas_nolluvia, HH$leader, "Severity of transport problems, non-rainy", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_f_1_and_f_2, HH$leader, "Severity of transport problems, avg. of rainy/non-rainy", "Leader")[[2]]))
```
#### Any problems
Question 3 asks if people had any problem transporting due to roads being poorly maintained,
```{r, echo=FALSE}
HH$use_f_3_problemas_transp <- HH[,"_f_3_problemas_transp"]
HH$use_f_3_problemas_transp <- makeBinary(paste0("use_f_3_problemas_transp"), HH, 1)
kable(as.data.frame(crossTab(HH$use_f_3_problemas_transp, HH$leader, "Had any problems to transport", "Leader")[[2]]))
```
#### Price reductions
Question 3.2 asks how often people had issues with reduction of prices as a consequence of poorly maintained roads.
```{r echo=FALSE}
HH$use_f3_2_problemas_reduccion <- HH[,"_f3_2_problemas_reduccion"]
HH$use_f3_2_problemas_reduccion[is.na(HH$use_f3_2_problemas_reduccion)] <- 0
HH$use_f3_2_problemas_reduccion[HH$use_f3_2_problemas_reduccion==99] <- 0
HH$use_f3_2_problemas_reduccion[HH$use_f3_2_problemas_reduccion==100] <- 0
kable(as.data.frame(crossTab(HH$use_f3_2_problemas_reduccion, HH$leader, "Price differences due to bad roads (1=never,6=always)", "Leader")[[2]]))
```
#### Loses due to bad roads
Question 4 asks if people lost part of their production due to the bad conditions of roads.
```{r, echo=FALSE}
HH$use_f_4_perdio_produccion <- makeBinary("_f_4_perdio_produccion",HH, 1)
kable(table(HH$use_f_4_perdio_produccion))
```
#### Value of losses
```{r, echo=FALSE}
HH$use_f_5_valor_perdida_1 <- HH[,"_f_5_valor_perdida_1"]
HH$use_f_5_valor_perdida_1 <- as.numeric(HH$use_f_5_valor_perdida_1)
HH$use_f_5_valor_perdida_1[is.na(HH[,"_f_5_valor_perdida_1"])] <- 0
HH$use_f_5_valor_perdida_1[HH[,"_f_5_valor_perdida_1"]==-99] <- mean(HH$use_f_5_valor_perdida_1[HH[,"_f_5_valor_perdida_1"]!=99])
hist(HH$use_f_5_valor_perdida_1)
HH$use_f_5_valor_perdida_1_log <- log(HH$use_f_5_valor_perdida_1+1)
HH$use_f_5_valor_perdida_1_log[is.na(HH[,"use_f_5_valor_perdida_1_log"])] <- 0
hist(HH$use_f_5_valor_perdida_1_log)
HH$use_f_5_valor_perdida_2 <- HH[,"_f_5_valor_perdida_2"]
HH$use_f_5_valor_perdida_2 <- as.numeric(HH$use_f_5_valor_perdida_2)
HH$use_f_5_valor_perdida_2[is.na(HH[,"_f_5_valor_perdida_2"])] <- 0
HH$use_f_5_valor_perdida_2[HH[,"_f_5_valor_perdida_2"]==-99] <- mean(HH$use_f_5_valor_perdida_2[HH[,"_f_5_valor_perdida_2"]!=99])
hist(HH$use_f_5_valor_perdida_2)
HH$use_f_5_valor_perdida_2_log <- log(HH$use_f_5_valor_perdida_2+1)
HH$use_f_5_valor_perdida_2_log <- log(HH$use_f_5_valor_perdida_2+1)
HH$use_f_5_valor_perdida_2_log[is.na(HH[,"use_f_5_valor_perdida_2_log"])] <- 0
hist(HH$use_f_5_valor_perdida_2_log)
par(pty="s")
plotRange <- range(na.omit(c(HH$use_f_5_valor_perdida_1_log, HH$use_f_5_valor_perdida_2_log)))
plot(HH$use_f_5_valor_perdida_1_log,
HH$use_f_5_valor_perdida_2_log,
xlim=plotRange,
ylim=plotRange,xlab="Pérdidas",ylab = "Pérdidas por diferencia de precios")
abline(a=0, b=1)
```
The survey changed a bit with respect to the rest of the questions that were in r1, related to products HHed, etc., so those are not reflected here.
#### Treatment effects for module F
```{r, echo=FALSE}
te_f1_and_f2 <- fitR("use_f_1_and_f_2", "F1 and F2. Severity of problems")
te_f3 <- fitR("use_f_3_problemas_transp", "F3. Transport problems")
te_f32<- fitR("use_f3_2_problemas_reduccion", "F3.2 Price reductions")
te_f4 <- fitR("use_f_4_perdio_produccion", "F4. Any losses")
te_f5 <- fitR("use_f_5_valor_perdida_1_log", "F5. Cost of losses (log)")
te_f52 <- fitR("use_f_5_valor_perdida_2_log", "F5.2 Cost of losses (log) due to price diffrences")
lapply(lapply(list(te_f1_and_f2,
te_f3,
te_f32,
te_f4,
te_f5,
te_f52),
resVec), kable)
```
## 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
There are some new questions in r2.
We have:
* g1: Quality of nearest road (paved=1, dirt=5).
* g2: Features of nearest roads that are paved.
* g3: Features of nearest road that are not paved.
* g4: Nearest road is passable.
* g5: Conditions of nearest road.
* g6: 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.
* g8: Time to municipal center (minutes)
* g9: Time to the nearest paved road (minutes)
* g10: 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]]))
```
Is the nearest road passable?
```{r, echo=FALSE}
HH$use_g_4_transitable <- makeBinary("_g_4_transitable",HH, 1)
kable(table(HH$use_g_4_transitable))
```
Quality of roads used habitually
```{r, echo=FALSE}
HH$use_g_5_calificar <- HH[,"_g_5_calificar"]
HH$use_g_5_calificar[is.na(HH$use_g_5_calificar)] <- median(HH$use_g_5_calificar[!is.na(HH[,"_g_5_calificar"])])
HH$use_g_5_calificar[HH[,"_g_5_calificar"]==100] <- median(HH$use_g_5_calificar[!is.na(HH[,"_g_5_calificar"])])
kable(table(HH$use_g_5_calificar),caption = "1=Very Bad, 5= Very good")
```
Last improvements to local road (months).
```{r, echo=FALSE}
HH$use_g_6_tiempo_mejora <- NA
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora"]==1] <- .5
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora"]==2] <- 7
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora"]==3] <- 18
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora"]==4] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "1"] <- 12
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "10 año"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "10 años"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "12 años"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "15 año"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "15 años"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "2 año"] <- 24
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "20 años"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "3 años"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "4 meses"] <- 4
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "5 meses"] <- 5
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "6 año"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "6 meses"] <- 6
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "7 años"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "7 meses"] <- 7
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "8 años"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "8 mese"] <- 8
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "8 meses"] <- 8
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "9 meses"] <- 9
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "Actualmente está haciendo mejora"] <- .5
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "Aún no se está terminando las mejoras"] <- .5
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "Cada votación"] <- 18
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "El asfaltado no necesita reparaciónes"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "No reparo nunca desde que se inauguro"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "No se arreagla."] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "No se hizo ningun trabajo"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "Nunca"] <- 30
HH$use_g_6_tiempo_mejora[HH[,"_g_6_tiempo_mejora_otro"] == "Nunca se arreglo"] <- 30
HH$use_g_6_tiempo_mejora[is.na(HH$use_g_6_tiempo_mejora)] <- median(HH$use_g_6_tiempo_mejora[!is.na(HH$use_g_6_tiempo_mejora)])
hist(HH$use_g_6_tiempo_mejora)
```
How long does it take to get to the center of municipality (minutes)
```{r, echo=FALSE}
# g3
HH$use_g_8_epoca_lluvia_hr <- cleanNeg99mean("_g_8_epoca_lluvia_hr")
HH$use_g_8_epoca_lluvia_min <- cleanNeg99mean("_g_8_epoca_lluvia_min")
HH$use_g_8_epoca_lluvia_min_com <- HH$use_g_8_epoca_lluvia_min + 60*HH$use_g_8_epoca_lluvia_hr
HH$use_g_8_epoca_sin_lluvia_hr <- cleanNeg99mean("_g_8_epoca_sin_lluvia_hr")
HH$use_g_8_epoca_sin_lluvia_min <- cleanNeg99mean("_g_8_epoca_sin_lluvia_min")
HH$use_g_8_epoca_sin_lluvia_min_com <- HH$use_g_8_epoca_sin_lluvia_min + 60*HH$use_g_8_epoca_sin_lluvia_hr
HH$use_g_8_combined <- apply(cbind(HH$use_g_8_epoca_lluvia_min_com,
HH$use_g_8_epoca_sin_lluvia_min_com),
1,
mean)
hist(HH$use_g_8_combined)
```
How long does it take to get frm your place to the nearest paved road
```{r, echo=FALSE}
# g9
HH$use_g_9_epoca_lluvia_hr <- cleanNeg99mean("_g_9_epoca_lluvia_hr")
HH$use_g_9_epoca_lluvia_min <- cleanNeg99mean("_g_9_epoca_lluvia_min")
HH$use_g_9_epoca_lluvia_min_com <- HH$use_g_9_epoca_lluvia_min + 60*HH$use_g_9_epoca_lluvia_hr
HH$use_g_9_epoca_sin_lluvia_hr <- cleanNeg99mean("_g_9_epoca_sin_lluvia_hr")
HH$use_g_9_epoca_sin_lluvia_min <- cleanNeg99mean("_g_9_epoca_sin_lluvia_min")
HH$use_g_9_epoca_sin_lluvia_min_com <- HH$use_g_9_epoca_sin_lluvia_min + 60*HH$use_g_9_epoca_sin_lluvia_hr
HH$use_g_9_combined <- apply(cbind(HH$use_g_9_epoca_lluvia_min_com,
HH$use_g_9_epoca_sin_lluvia_min_com),
1,
mean)
hist(HH$use_g_9_combined)
```
Awareness of plan to improve road
```{r, echo=FALSE}
# g10
HH$use_g_10_plan_mejora <- makeBinary("_g_10_plan_mejora", HH, 1)
kable(as.data.frame(crossTab(HH$use_g_10_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_10_mat <- HH[,c("use_g_1_estado_camino","use_g_4_transitable","use_g_5_calificar","use_g_6_tiempo_mejora","use_g_8_combined","use_g_9_combined","use_g_10_plan_mejora")]
cor(gr_1_to_10_mat)
prcomp_g_1_to_10 <- prcomp(gr_1_to_10_mat, center=TRUE, scale=TRUE)
kable(summary(prcomp_g_1_to_10)[[2]])
kable(summary(prcomp_g_1_to_10)[[6]])
HH$use_g_1_to_10_prcomp <- predict(prcomp_g_1_to_10)[,1]
```
#### Treatment effects
```{r, echo=FALSE}
te_g1_to_6 <- fitR("use_g_1_to_10_prcomp", "G1 to G10. Road disrepair index")
te_g1 <- fitR("use_g_1_estado_camino", "G1. Quality of nearest road (rev. coded)")
te_g5 <- fitR("use_g_5_calificar", "G5. State of roads")
te_g6 <- fitR("use_g_6_tiempo_mejora", "G6. Time since improvement")
te_g8 <- fitR("use_g_8_combined", "G8. Time spent traveling to city center")
te_g9 <- fitR("use_g_9_combined", "G9. Time to closest paved road")
te_g10 <- fitR("use_g_10_plan_mejora", "G10. Awareness of improvement plan")
lapply(lapply(list(te_g1_to_6,
te_g1,
te_g5,
te_g6,
te_g8,
te_g9,
te_g10),
resVec), kable)
```
### Electricity
We have:
* g12: house connected to electricity grid. There is almost no variation in this variable (99% say yes).
* g13: has three-phase current connection. Also very little variation here (93% say no).
* g14: any extension of grid in your muni
* g15: improvements in current quality
* g16: your production has benefited from electricity improvements
We can add g12 and g13 to get an index:
```{r, echo=FALSE}
HH$use_g_12_ande <- makeBinary("_g_12_ande", HH, 1)
HH$use_g_13_corriente <- makeBinary("_g_13_corriente", HH, 1)
HH$use_g12_plus_g13 <- HH$use_g_12_ande + HH$use_g_13_corriente
kable(as.data.frame(crossTab(HH$use_g12_plus_g13, HH$leader, "Electricity access index", "Leader")[[2]]))
```
```{r, echo=FALSE}
HH$use_g_14_extension_red <- makeBinary("_g_14_extension_red", HH, 1)
HH$use_g_15_calidad_corriente <- makeBinary("_g_15_calidad_corriente", HH, 1)
HH$use_g_16_beneficio <- makeBinary("_g_16_beneficio", HH, 1)
kable(as.data.frame(crossTab(HH$use_g_14_extension_red, HH$leader, "Recent elec. grid ext.", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_g_15_calidad_corriente, HH$leader, "Recent elec. current impr.", "Leader")[[2]]))
kable(as.data.frame(crossTab(HH$use_g_16_beneficio, HH$leader, "Prod. benefited from elec. improv.", "Leader")[[2]]))
gr_14_to_16_mat <- HH[,c("use_g_14_extension_red",
"use_g_15_calidad_corriente",
"use_g_16_beneficio")]
cor(gr_14_to_16_mat)
prcomp_g_14_to_16 <- prcomp(gr_14_to_16_mat, center=TRUE, scale=TRUE)
kable(summary(prcomp_g_14_to_16)[[2]])
kable(summary(prcomp_g_14_to_16)[[6]])
HH$use_gr_14_to_16_prcomp <- predict(prcomp_g_14_to_16)[,1]
te_g12_and_13 <- fitR("use_g12_plus_g13", "G12 and 13. Elec. access index")
te_g14_to_16 <- fitR("use_gr_14_to_16_prcomp", "G14 to 16. Elec. improve. index")
te_g14 <- fitR("use_g_14_extension_red", "G14. Elctrc. grid extend")
te_g15 <- fitR("use_g_15_calidad_corriente", "G15. Elctrc. improve current")
te_g16 <- fitR("use_g_16_beneficio", "G16. Elctrc. benefit fr. imprvmnt.")
lapply(lapply(list(te_g12_and_13,
te_g14_to_16,
te_g14,
te_g15,
te_g16),
resVec), kable)
```
## Training and Technical Assistance (H)
This section contains data on
- Receipt of any training or technial assistance, and rest follow only if they answered yes,
- From whom the training or technical assistance was received, and then
- The type of assistance.
```{r}
print(dfSummary(HH[,grep("_h_", names(HH))]), method="render")
```
Looking at whether any training or technical assistance was received:
```{r, echo=FALSE}
HH$use_h_capacitacion_sino <- makeBinary("_h_1_capacitacion_sino", HH, 1)
kable(as.data.frame(crossTab(HH$use_h_capacitacion_sino, HH$leader, "Rec. training or tech. asstnc.", "Leader")[[2]]))
te_h_capacitacion_sino <- fitR("use_h_capacitacion_sino", "H. Training or technical assistance")
kable(resVec(te_h_capacitacion_sino))
```
Organizations:
There is so many missing values in these answers that I was not sure if I should clean these data. Here 1 = yes and 2 = no.
```{r, echo=FALSE}
provList <- c("1. From prod. orgn.",
"2. From MAG/DEAG",
"3. From CAH/BNF",
"4. From munic.",
"5. From private entity",
"6. From SNPP/SINAFOCAL",
"7. From bank")
HH$use_h_2_proveedor_1 <- HH[,"_h_2_proveedor_2_1"]
HH$use_h_2_proveedor_2 <- HH[,"_h_2_proveedor_2_2"]