Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

use permutation test to find the answer< Is there a significant difference in th

ID: 3329185 • Letter: U

Question

use permutation test to find the answer< Is there a significant difference in the rate of murders?> Please provide R code for me. Thank!

Boroughs

Number of murders

Population

a

2

158,251

b

4

160,436

c

12

240,499

d

13

200,543

e

14

232,774

f

14

237,927

g

14

281,395

l

14

191,123

m

15

254927

n

17

182,445

o

19

310,554

p

20

187,029

q

21

275499

w

23

219,582

t

24

357,538

y

24

220,087

z

26

307,710

nn

31

313,935

nm

31

206,285

mn

32

312,245

ab

32

256,012

ba

32

259,742

ed

33

255,483

de

34

339,314

sa

36

255,540

as

36

276,938

cr

38

364,815

rc

42

247,182

sw

49

288,717

ws

56

310,460

tr

79

304,481

Boroughs

Number of murders

Population

a

2

158,251

b

4

160,436

c

12

240,499

d

13

200,543

e

14

232,774

f

14

237,927

g

14

281,395

l

14

191,123

m

15

254927

n

17

182,445

o

19

310,554

p

20

187,029

q

21

275499

w

23

219,582

t

24

357,538

y

24

220,087

z

26

307,710

nn

31

313,935

nm

31

206,285

mn

32

312,245

ab

32

256,012

ba

32

259,742

ed

33

255,483

de

34

339,314

sa

36

255,540

as

36

276,938

cr

38

364,815

rc

42

247,182

sw

49

288,717

ws

56

310,460

tr

79

304,481

Explanation / Answer

n_murders <-c(2,4,12,13,14,14,14,14,15,17,19,20,21,23,24,24,26,31,31,32,32,32,33,34,36,36,38,42,49,56,79)
population <- c(158251,160436,240499,200543,232774,237927,281395,191123,254927,182445,310554,187029,275499,219582,357538,220087,307710,313935,206285,312245,256012,259742,255483,339314,255540,276938,364815,247182,288717,310460,304461)
install.packages("coin")
library(coin)
DV <- c(n_murders,population)
IV <- factor(rep(c("A", "B"), c(length(n_murders), length(population))))
library(coin)
pvalue(oneway_test(DV ~ IV, alternative="greater",distribution=approximate(B=9999)))
[1] 1
99 percent confidence interval:
0.9994703 1.0000000

install.packages("perm")
library(perm)
permTS(DV ~ IV, alternative="greater", method="exact.mc",control=permControl(nmc=10^4-1))$p.value
[1] 1

# Both Permutaion Package tests produce a p-value of 1 which is greater than 0.05. Hence reject the null hypothesis that there is no significant difference in rate of murders.