implementation <- read.csv("C:/Users/dan luis/Downloads/implementation.csv")
describe(implementation)
## implementation
##
## 11 Variables 368 Observations
## --------------------------------------------------------------------------------
## Respondent
## n missing distinct Info Mean Gmd .05 .10
## 368 0 368 1 184.5 123 19.35 37.70
## .25 .50 .75 .90 .95
## 92.75 184.50 276.25 331.30 349.65
##
## lowest : 1 2 3 4 5, highest: 364 365 366 367 368
## --------------------------------------------------------------------------------
## Curfew
## n missing distinct Info Mean Gmd
## 368 0 4 0.749 4.514 0.6464
##
## Value 2 3 4 5
## Frequency 3 27 116 222
## Proportion 0.008 0.073 0.315 0.603
## --------------------------------------------------------------------------------
## Patrolling
## n missing distinct Info Mean Gmd
## 368 0 2 0.707 4.62 0.4727
##
## Value 4 5
## Frequency 140 228
## Proportion 0.38 0.62
## --------------------------------------------------------------------------------
## cctv
## n missing distinct Info Mean Gmd
## 368 0 4 0.774 4.427 0.7712
##
## Value 2 3 4 5
## Frequency 8 44 99 217
## Proportion 0.022 0.120 0.269 0.590
## --------------------------------------------------------------------------------
## Police.visibility
## n missing distinct Info Mean Gmd
## 368 0 4 0.723 4.541 0.6375
##
## Value 2 3 4 5
## Frequency 4 26 105 233
## Proportion 0.011 0.071 0.285 0.633
## --------------------------------------------------------------------------------
## Drug.programs
## n missing distinct Info Mean Gmd
## 368 0 5 0.692 4.592 0.5743
##
## lowest : 1 2 3 4 5, highest: 1 2 3 4 5
##
## Value 1 2 3 4 5
## Frequency 1 5 10 111 241
## Proportion 0.003 0.014 0.027 0.302 0.655
## --------------------------------------------------------------------------------
## BIN
## n missing distinct Info Mean Gmd
## 368 0 4 0.713 4.562 0.6067
##
## Value 2 3 4 5
## Frequency 4 20 109 235
## Proportion 0.011 0.054 0.296 0.639
## --------------------------------------------------------------------------------
## D.P.hotline.numbers
## n missing distinct Info Mean Gmd
## 368 0 3 0.716 4.562 0.6038
##
## Value 3 4 5
## Frequency 28 105 235
## Proportion 0.076 0.285 0.639
## --------------------------------------------------------------------------------
## CPT.in.social.media
## n missing distinct Info Mean Gmd
## 368 0 4 0.733 4.524 0.6517
##
## Value 2 3 4 5
## Frequency 8 19 113 228
## Proportion 0.022 0.052 0.307 0.620
## --------------------------------------------------------------------------------
## IEC
## n missing distinct Info Mean Gmd
## 368 0 4 0.711 4.565 0.6051
##
## Value 2 3 4 5
## Frequency 4 20 108 236
## Proportion 0.011 0.054 0.293 0.641
## --------------------------------------------------------------------------------
## Seminars.Trainings
## n missing distinct Info Mean Gmd
## 368 0 3 0.727 4.554 0.6017
##
## Value 3 4 5
## Frequency 26 112 230
## Proportion 0.071 0.304 0.625
## --------------------------------------------------------------------------------
significance <- read.csv("C:/Users/dan luis/Downloads/significance.csv")
describe(significance)
## significance
##
## 11 Variables 368 Observations
## --------------------------------------------------------------------------------
## Respondent
## n missing distinct Info Mean Gmd .05 .10
## 368 0 368 1 184.5 123 19.35 37.70
## .25 .50 .75 .90 .95
## 92.75 184.50 276.25 331.30 349.65
##
## lowest : 1 2 3 4 5, highest: 364 365 366 367 368
## --------------------------------------------------------------------------------
## Curfew
## n missing distinct Info Mean Gmd
## 368 0 3 0.639 4.668 0.4806
##
## Value 3 4 5
## Frequency 11 100 257
## Proportion 0.030 0.272 0.698
## --------------------------------------------------------------------------------
## Patrolling
## n missing distinct Info Mean Gmd
## 368 0 5 0.731 4.549 0.6035
##
## lowest : 1 2 3 4 5, highest: 1 2 3 4 5
##
## Value 1 2 3 4 5
## Frequency 1 2 18 120 227
## Proportion 0.003 0.005 0.049 0.326 0.617
## --------------------------------------------------------------------------------
## cctv.installations
## n missing distinct Info Mean Gmd
## 368 0 4 0.748 4.505 0.6649
##
## Value 2 3 4 5
## Frequency 5 27 113 223
## Proportion 0.014 0.073 0.307 0.606
## --------------------------------------------------------------------------------
## Police.visibility
## n missing distinct Info Mean Gmd
## 368 0 3 0.726 4.576 0.5486
##
## Value 3 4 5
## Frequency 14 128 226
## Proportion 0.038 0.348 0.614
## --------------------------------------------------------------------------------
## Drug.programs
## n missing distinct Info Mean Gmd
## 368 0 4 0.662 4.641 0.5112
##
## Value 2 3 4 5
## Frequency 3 8 107 250
## Proportion 0.008 0.022 0.291 0.679
## --------------------------------------------------------------------------------
## BIN
## n missing distinct Info Mean Gmd
## 368 0 4 0.721 4.571 0.5742
##
## Value 2 3 4 5
## Frequency 2 16 120 230
## Proportion 0.005 0.043 0.326 0.625
## --------------------------------------------------------------------------------
## D.P.hotline.numbers
## n missing distinct Info Mean Gmd
## 368 0 4 0.733 4.541 0.6199
##
## Value 1 3 4 5
## Frequency 1 26 113 228
## Proportion 0.003 0.071 0.307 0.620
## --------------------------------------------------------------------------------
## CPT.in.social.media
## n missing distinct Info Mean Gmd
## 368 0 5 0.699 4.56 0.6326
##
## lowest : 1 2 3 4 5, highest: 1 2 3 4 5
##
## Value 1 2 3 4 5
## Frequency 2 4 21 100 241
## Proportion 0.005 0.011 0.057 0.272 0.655
## --------------------------------------------------------------------------------
## IEC
## n missing distinct Info Mean Gmd
## 368 0 5 0.774 4.473 0.6654
##
## lowest : 1 2 3 4 5, highest: 1 2 3 4 5
##
## Value 1 2 3 4 5
## Frequency 1 3 25 131 208
## Proportion 0.003 0.008 0.068 0.356 0.565
## --------------------------------------------------------------------------------
## Seminars.Trainings
## n missing distinct Info Mean Gmd
## 368 0 5 0.773 4.473 0.6589
##
## lowest : 1 2 3 4 5, highest: 1 2 3 4 5
##
## Value 1 2 3 4 5
## Frequency 2 3 20 137 206
## Proportion 0.005 0.008 0.054 0.372 0.560
## --------------------------------------------------------------------------------
a1 <- as.numeric(implementation$Curfew)
b1 <- as.numeric(implementation$Patrolling)
c1 <- as.numeric(implementation$cctv)
d1 <- as.numeric(implementation$Police.visibility)
e1 <- as.numeric(implementation$Drug.programs)
f1 <- as.numeric(implementation$BIN)
g1 <- as.numeric(implementation$D.P.hotline.numbers)
h1 <- as.numeric(implementation$CPT.in.social.media)
i1 <- as.numeric(implementation$IEC)
j1 <- as.numeric(implementation$Seminars.Trainings)
implement <- rbind(a1,b1,c1,d1,e1,f1,g1,h1,i1,j1)
a2 <- as.numeric(significance$Curfew)
b2 <- as.numeric(significance$Patrolling)
c2 <- as.numeric(significance$cctv)
d2 <- as.numeric(significance$Police.visibility)
e2 <- as.numeric(significance$Drug.programs)
f2 <- as.numeric(significance$BIN)
g2 <- as.numeric(significance$D.P.hotline.numbers)
h2 <- as.numeric(significance$CPT.in.social.media)
i2 <- as.numeric(significance$IEC)
j2 <- as.numeric(significance$Seminars.Trainings)
significant <- rbind(a2,b2,c2,d2,e2,f2,g2,h2,i2,j2)
cor.test(implement,significant)
##
## Pearson's product-moment correlation
##
## data: implement and significant
## t = 132.91, df = 3678, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9040262 0.9151722
## sample estimates:
## cor
## 0.909763
hist(implement)
hist(significant)
Null Hypothesis: H0:ρ=0
Alternate Hypothesis: Ha:ρ≠0
Level of Significance: 0.05
Decision Rule: If we have a p-value of less the 0.05 (<0.05) it is
considered significant, otherwise.
Decision: Since our p-value = less than 0.01 (<0.001) is lesser than
0.05 which is the significance level, we reject the null
hypothesis.
Conclusion: There is sufficient evidence to conclude that there is a
significant linear relationship between x and y because the correlation
coefficient is significantly different from zero. Meaning there is a
significant relationship between the implementation level of the
programs on peace and order employed by Police Station 4 and the level
of significance of the programs on safety and protection as perceived by
residents in Barangay Linao, Ormoc City.
note: Even though the Pearson correlation coefficient appears to be significant, the variables are not normally distributed and should therefore not be evaluated with the Pearson formula.
occupation <- read.csv("C:/Users/dan luis/Downloads/occupation.csv")
Occupation <- as.factor(occupation$occupation)
summarytools::freq(Occupation,report.nas = F,totals = F,headings = F)
##
## Freq % % Cum.
## ---------------- ------ ------- --------
## employed 166 45.11 45.11
## student 95 25.82 70.92
## unemployed 107 29.08 100.00
describe(Occupation)
## Occupation
## n missing distinct
## 368 0 3
##
## Value employed student unemployed
## Frequency 166 95 107
## Proportion 0.451 0.258 0.291
#Implementation
c1 <- sd(implementation$Curfew,na.rm=TRUE)
c2 <- sd(implementation$Patrolling,na.rm=TRUE)
c3 <- sd(implementation$cctv,na.rm=TRUE)
c4 <- sd(implementation$Police.visibility,na.rm=TRUE)
c5 <- sd(implementation$Drug.programs,na.rm=TRUE)
c6 <- sd(implementation$BIN,na.rm=TRUE)
c7 <- sd(implementation$D.P.hotline.numbers,na.rm=TRUE)
c8 <- sd(implementation$CPT.in.social.media,na.rm=TRUE)
c9 <- sd(implementation$IEC,na.rm=TRUE)
c10 <- sd(implementation$Seminars.Trainings,na.rm=TRUE)
#Significance
d1 <- sd(significance$Curfew,na.rm=TRUE)
d2 <- sd(significance$Patrolling,na.rm=TRUE)
d3 <- sd(significance$cctv,na.rm=TRUE)
d4 <- sd(significance$Police.visibility,na.rm=TRUE)
d5 <- sd(significance$Drug.programs,na.rm=TRUE)
d6 <- sd(significance$BIN,na.rm=TRUE)
d7 <- sd(significance$D.P.hotline.numbers,na.rm=TRUE)
d8 <- sd(significance$CPT.in.social.media,na.rm=TRUE)
d9 <- sd(significance$IEC,na.rm=TRUE)
d10 <- sd(significance$Seminars.Trainings,na.rm=TRUE)
Imp <- sample(c(c1,c2,c3,c4,c5,c6,c7,c8,c9,c10))
Sig<-sample(c(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10))
df1<-data.frame(Imp,Sig)
df1
## Imp Sig
## 1 0.6683423 0.6046213
## 2 0.6240263 0.5667190
## 3 0.6411389 0.5311915
## 4 0.6486935 0.6880218
## 5 0.6489617 0.6416930
## 6 0.4861547 0.6506936
## 7 0.7847647 0.6924842
## 8 0.6753515 0.6840500
## 9 0.6319437 0.7016617
## 10 0.6959985 0.5685973
# average standard dev
## implementation
mean(Imp)
## [1] 0.6505376
# average standard dev
## implementation
mean(Sig)
## [1] 0.6329734