0% found this document useful (0 votes)
3 views8 pages

Session 6 Chi Square Test Section 3

The document presents results from various statistical tests, including Pearson's Chi-squared tests and Wilcoxon tests, analyzing burglary data across different London districts and demographics. Significant findings include a strong association between burglary methods and district types, as well as notable differences in male and female populations across boroughs. Effect sizes indicate weak associations for burglary methods and dwelling types, while some tests show no significant differences in populations between inner and outer London.

Uploaded by

sreedevaksb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views8 pages

Session 6 Chi Square Test Section 3

The document presents results from various statistical tests, including Pearson's Chi-squared tests and Wilcoxon tests, analyzing burglary data across different London districts and demographics. Significant findings include a strong association between burglary methods and district types, as well as notable differences in male and female populations across boroughs. Effect sizes indicate weak associations for burglary methods and dwelling types, while some tests show no significant differences in populations between inner and outer London.

Uploaded by

sreedevaksb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Session 6 chi square test section 3

Pearson's Chi-squared test

data: mytable
X-squared = 54.193, df = 8, p-value = 6.333e-09

chisq_out$observed
Door Window
SW11 817 321
SW12 292 180
SW15 416 276
SW16 74 36
SW17 396 238
SW18 357 269
SW19 55 33
SW4 21 22
SW8 68 36
> chisq_out$expected
Door Window
SW11 727.01510 410.98490
SW12 301.53878 170.46122
SW15 442.08651 249.91349
SW16 70.27387 39.72613
SW17 405.03302 228.96698
SW18 399.92219 226.07781
SW19 56.21909 31.78091
SW4 27.47069 15.52931
SW8 66.44075 37.55925
> chisq_out$stdres
Door Window
SW11 6.5965422 -6.5965422
SW12 -0.9748496 0.9748496
SW15 -2.2758927 2.2758927
SW16 0.7502759 -0.7502759
SW17 -0.8160082 0.8160082
SW18 -3.8973636 3.8973636
SW19 -0.2736531 0.2736531
SW4 -2.0657481 2.0657481
SW8 0.3226383 -0.3226383

Pearson's Chi-squared test with simulated p-value (based on 2000


replicates)

data: mytable
X-squared = 54.193, df = NA, p-value = 0.0004998

# calculate effect size


> CramerV(mytable, conf.level = 0.95)
Cramer V lwr.ci upr.ci
0.11777425 0.07705922 0.14219813
SECTION 4

mytable
Door Window
Bedsit 25 13
Bungalow 445 304
Council 56 20
Detached 51 47
Flat_Mais 948 450
Hostel 39 19
Multi_Occ 50 17
Private 87 61
Semi 186 140
Terraced 569 322

Pearson's Chi-squared test

data: mytable
X-squared = 36.866, df = 9, p-value = 2.78e-05

> # simple chi-squared with additional outputs


> chisq_out <- chisq.test(mytable)
> chisq_out$observed
Door Window
Bedsit 25 13
Bungalow 445 304
Council 56 20
Detached 51 47
Flat_Mais 948 450
Hostel 39 19
Multi_Occ 50 17
Private 87 61
Semi 186 140
Terraced 569 322
> chisq_out$expected
Door Window
Bedsit 24.24734 13.75266
Bungalow 477.92777 271.07223
Council 48.49467 27.50533
Detached 62.53261 35.46739
Flat_Mais 892.04677 505.95323
Hostel 37.00909 20.99091
Multi_Occ 42.75188 24.24812
Private 94.43700 53.56300
Semi 208.01663 117.98337
Terraced 568.53624 322.46376
> chisq_out$stdres
Door Window
Bedsit 0.25534152 -0.25534152
Bungalow -2.78979786 2.78979786
Council 1.80947044 -1.80947044
Detached -2.45568698 2.45568698
Flat_Mais 3.90240270 -3.90240270
Hostel 0.54814083 -0.54814083
Multi_Occ 1.85891325 -1.85891325
Private -1.29729669 1.29729669
Semi -2.65227043 2.65227043
Terraced 0.03687946 -0.03687946
Pearson's Chi-squared test with simulated p-value (based on 2000
replicates)

data: mytable
X-squared = 36.866, df = NA, p-value = 0.0004998

> # calculate effect size


> CramerV(mytable, conf.level = 0.95)
Cramer V lwr.ci upr.ci
0.09786797 0.05192032 0.11983891

Section 5

In out as factor

'data.frame': 33 obs. of 8 variables:


$ borough: chr "City of London" "Barking & Dagenham" "Barnet" "Bexley" ...
$ popT : int 7185 163944 314564 218307 263464 295532 198020 330587 300948 273559 ...
$ popM : int 3832 78068 149781 105148 127806 141785 95398 159111 147563 130706 ...
$ popF : int 3353 85876 164783 113159 135658 153747 102622 171476 153385 142853 ...
$ male : int 204 5638 8603 6147 5151 9813 6772 8983 8835 8696 ...
$ female : int 189 6826 9802 6614 5240 10621 6731 9810 8579 9645 ...
$ total : int 393 12464 18405 12761 10391 20434 13503 18793 17414 18341 ...
$ in_out : Factor w/ 2 levels "Inner","Outer": 1 2 2 2 2 2 1 2 2 2 ...

Section 6

Wilcoxon signed rank test with continuity correction

data: AandE$male and AandE$female


V = 81.5, p-value = 0.0003899
alternative hypothesis: true location shift is not equal to 0

summary(AandE$male)
Min. 1st Qu. Median Mean 3rd Qu. Max.
204 5499 6907 6835 8301 9813
> summary(AandE$female)
Min. 1st Qu. Median Mean 3rd Qu. Max.
189 5732 7355 7198 8895 10621
> # calculate effect size
> Zstat1 <- qnorm(wtest1$p.value/2)
> abs(Zstat1)/sqrt(nrow(AandE))
[1] 0.6174247

SECTION 7

Wilcoxon rank sum exact test

data: AandE$total by AandE$in_out


W = 139, p-value = 0.8434
alternative hypothesis: true location shift is not equal to 0
summary(mydata.inner$total)
Min. 1st Qu. Median Mean 3rd Qu. Max.
393 12204 14978 13811 17087 18805
> summary(mydata.outer$total)
Min. 1st Qu. Median Mean 3rd Qu. Max.
9249 11152 14081 14197 16659 20434

SECTION 8

Wilcoxon signed rank exact test

data: AandE$pMale and AandE$pFemale


V = 340, p-value = 0.296
alternative hypothesis: true location shift is not equal to 0
summary(AandE$pMale)
Min. 1st Qu. Median Mean 3rd Qu. Max.
40.30 58.46 65.81 64.93 70.99 85.57
> summary(AandE$pFemale)
Min. 1st Qu. Median Mean 3rd Qu. Max.
38.63 58.45 64.65 64.07 68.68 83.01

Wilcoxon rank sum exact test

data: AandE$pTotal by AandE$in_out


W = 203, p-value = 0.009935
alternative hypothesis: true location shift is not equal to 0

summary(mydata.inner$pTotal)
Min. 1st Qu. Median Mean 3rd Qu. Max.
49.66 67.11 68.48 68.48 72.26 84.24
> summary(mydata.outer$pTotal)
Min. 1st Qu. Median Mean 3rd Qu. Max.
39.44 58.16 62.45 61.54 66.16 76.03

Effect size 0.4487897

Section 2

Fig 6.1
Fig 6.2

The above plots show burglary via door and window in different districts of London. The Door and
window entry is highest in SW11 district.

Fig 6.3

From the above plot we can see SW11 denoted by dark blue holds most burglary and it’s also clear
that burglary via door ( red colour spread ) holds more numbers compared to the windows( orange
colour spread ).

SECTION 3

Chi Square test output,


X-squared = 54.193, df = 8, p-value = 6.333e-09

Chi Square standard residual,

Door Window
SW11 6.5965422 -6.5965422
SW12 -0.9748496 0.9748496
SW15 -2.2758927 2.2758927
SW16 0.7502759 -0.7502759
SW17 -0.8160082 0.8160082
SW18 -3.8973636 3.8973636
SW19 -0.2736531 0.2736531
SW4 -2.0657481 2.0657481
SW8 0.3226383 -0.3226383

The degree of freedom is 8 and the p value is very much less than 0.05, hence we reject the
˳
null hypothesis (H ). The standard residual also implies that door entry in SW11 is far more
than expected and window entry far less than expected when looking at all the districts. In
case of SW19 its pretty near to what we expected.

By doing Monte Carlo simulation, the p value has become much larger ie. 0.0004998 from
the above p value from previous chi square test. But still it is less than 0.05, so we reject the null
Hypothesis.

Cramer’s V calculations have given us the effect size of 0.11 which means the effect size is small. And
the variables in our case are weakly associated. It is statistically significant.

SECTION 4
From the above two plots, its observed that Flat has the highest number of door and
window entries for burglary.

Pearson's Chi-squared test

X-squared = 36.866, df = 9, p-value = 2.78e-05

Door Window
Bedsit 0.25534152 -0.25534152
Bungalow -2.78979786 2.78979786
Council 1.80947044 -1.80947044
Detached -2.45568698 2.45568698
Flat_Mais 3.90240270 -3.90240270
Hostel 0.54814083 -0.54814083
Multi_Occ 1.85891325 -1.85891325
Private -1.29729669 1.29729669
Semi -2.65227043 2.65227043
Terraced 0.03687946 -0.03687946

The p value from chi square test is less than 0.05 hence we reject the null hypothesis. It
means no association of door and window entry with the dwelling type; this can be seen
from the standard residual data above where the difference between the observed samples
and expected has significant differences.

Cramers V value

Cramer V lwr.ci upr.ci


0.09786797 0.05192032 0.11983891
The cramers value 0.097 signifies there is statistical significance, but the variables in this
case ie. door and window entry burglaries are weakly associated with the dwelling type.

SECTION 6

Wilcoxon signed rank test with continuity correction

data: AandE$male and AandE$female


V = 81.5, p-value = 0.0003899

The p value is less than 0.05 we reject the null hypothesis. There is difference with male and
female population associated with London boroughs.

We then calculated the effect size which is 0.61 ( large diff ).

SECTION 7

By running the Mann-Whitney U Test on total population and inner outer London, the result
is as follows;

data: AandE$total by AandE$in_out

W = 139, p-value = 0.8434

The p value is above 0.05, so we cannot reject the null hypothesis safely as there is 84%
chance that we might be wrong. No difference between inner and outer London.

SECTION 8

Wilcoxon signed rank exact test

data: AandE$pMale and AandE$pFemale


V = 340, p-value = 0.296

The p value is well above 0.05, it means if we reject null hypothesis there is approximately
30% chance that we are wrong. So we accept the null hypothesis ie. there is no diff between
male and female in terms of percentage associated with London borough.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy