chisq<-chisq.test(mon)
library(A3)
library(askpass)
library(assertthat)
library(backports)
library(callr)
library(classInt)
library(cellranger)
library(cli)
library(colorspace)
library(crayon)
library(desc)
library(digest)
library(e1071)
library(ellipsis)
library(evaluate)
library(fansi)
library(glue)
library(highr)
library(hms)
library(markdown)
library(magrittr)
mon<- matrix(c(42,29,41,35,58,47,39,40,43,46,40,40),
ncol = 12, byrow = TRUE)
rownames(mon) <- c("Observed Homicide Cases")
colnames(mon) <- c("Jan","Feb","March","Apr","May",
"June","July","August","Sept",
"Oct","Nov","Dec")
crime=as.table(mon)
mon
#calculate test
chisq$observed
#calculate test
chisq$observed
library(pillar)
library(vcd)
library(vctrs)
chisq$expected
#calculate test
chisq$observed
library(yaml)
library(zoo)
library(boot, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(class, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(cluster, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(codetools, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(compiler, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(foreign, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(KernSmooth, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(lattice, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(MASS, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(Matrix, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(mgcv, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(nlme, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(nnet, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(parallel, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(rpart, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(spatial, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(splines, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(stats4, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(survival, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(tools, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(tcltk, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(translations, lib.loc = "C:/Program Files/R/R-3.6.3/library")
library(rgdal)
library(rprojroot)
library(rlang)
library(sys)
library(R6)
library(RColorBrewer)
library(raster)
library(Rcpp)
library(readxl)
library(rematch)
library(ps)
library(progress)
library(processx)
library(prettyunits)
library(praise)
library(png)
library(plotrix)
library(pkgconfig)
library(pkgload)
library(pkgbuild)
library(lmtest)
mon<- matrix(c(42,29,41,35,58,47,39,40,43,46,40,40),
ncol = 12, byrow = TRUE)
rownames(mon) <- c("Observed Homicide Cases")
colnames(mon) <- c("Jan","Feb","March","Apr","May",
"June","July","August","Sept",
"Oct","Nov","Dec")
crime=as.table(mon)
mon
#calculate test
chisq$observed
chisq$expected
library(jpeg)
library(testthat)
library(tibble)
library(utf8)
mon<- matrix(c(42,29,41,35,58,47,39,40,43,46,40,40),
ncol = 12, byrow = TRUE)
rownames(mon) <- c("Observed Homicide Cases")
colnames(mon) <- c("Jan","Feb","March","Apr","May",
"June","July","August","Sept",
"Oct","Nov","Dec")
crime=as.table(mon)
mon
#calculate test
chisq$observed
chisq$expected
#calculate test
chisq$observed
#H0:The two variable are independent
#H1:The two variable related to each other or dependent
mon<- matrix(c(141,73,224,62),ncol = 2, byrow = TRUE)
rownames(mon) <- c("Have relationship with victim","No relationship with victim")
colnames(mon) <- c("Male","Female")
crime=as.table(mon)
mon
#calculate test
chisq$observed
chisq$expected
#H0:The two variable are independent
#H1:The two variable related to each other or dependent
mon<- matrix(c(141,73,224,62),ncol = 2, byrow = TRUE)
rownames(mon) <- c("Have relationship with victim","No relationship with victim")
colnames(mon) <- c("Male","Female")
crime=as.table(mon)
mon
#calculate test
chisq$observed
chisq.test(mon)
#H0:The two variable are independent
#H1:The two variable related to each other or dependent
mon<- matrix(c(141,73,224,62),ncol = 2, byrow = TRUE)
rownames(mon) <- c("Have relationship with victim","No relationship with victim")
colnames(mon) <- c("Male","Female")
crime=as.table(mon)
mon
chisq.test(mon)
#H0:The two variable are independent
#H1:The two variable related to each other or dependent
mon<- matrix(c(141,73,224,62),ncol = 2, byrow = TRUE)
rownames(mon) <- c("Have relationship with victim","No relationship with victim")
colnames(mon) <- c("Male","Female")
crime=as.table(mon)
mon
chisq.test(mon)
alpha <-0.05
x2.alpha<-qchisq(alpha, df=1,lower.tail=FALSE)
x2.alpha
#H0:The two variable are independent
#H1:The two variable related to each other or dependent
mon<- matrix(c(141,73,224,62),ncol = 2, byrow = TRUE)
rownames(mon) <- c("Have relationship with victim","No relationship with victim")
colnames(mon) <- c("Male","Female")
crime=as.table(mon)
mon
chisq.test(mon)
alpha <-0.05
x2.alpha<-qchisq(alpha, df=1,lower.tail=FALSE)
x2.alpha
#H0:The two variable are independent
#H1:The two variable related to each other or dependent
mon<- matrix(c(141,73,224,62),ncol = 2, byrow = TRUE)
rownames(mon) <- c("Have relationship with victim","No relationship with victim")
colnames(mon) <- c("Male","Female")
crime=as.table(mon)
mon
chisq.test(mon)
chisq$observed
chisq$estimated
alpha <-0.05
x2.alpha<-qchisq(alpha, df=1,lower.tail=FALSE)
#table
mon<- matrix(c(141,73,224,62),ncol = 2, byrow = TRUE)
rownames(mon) <- c("Have relationship with victim","No relationship with victim")
colnames(mon) <- c("Male","Female")
crime=as.table(mon)
mon
chisq.test(mon)
alpha <-0.05
x2.alpha<-qchisq(alpha, df=1,lower.tail=FALSE)
x2.alpha
chisq$observed
chisq(mon)$observed
chisq(mon)$estimated
#table
mon<- matrix(c(141,73,224,62),ncol = 2, byrow = TRUE)
rownames(mon) <- c("Have relationship with victim","No relationship with victim")
colnames(mon) <- c("Male","Female")
crime=as.table(mon)
mon
chisq.test(mon)
alpha <-0.05
#table
mon<- matrix(c(141,73,224,62),ncol = 2, byrow = TRUE)
rownames(mon) <- c("Have relationship with victim","No relationship with victim")
colnames(mon) <- c("Male","Female")
crime=as.table(mon)
mon
chisq.test(mon)
alpha <-0.05
x2.alpha<-qchisq(alpha, df=1,lower.tail=FALSE)
x2.alpha
