Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
314 views
in Technique[技术] by (71.8m points)

statistics - Chi Square test in R

I'm trying to do a Chi-square test of independence and goodness of fit test in R. I'm a beginner still not very comfortable with the two tests and how they differ. If I understand it correctly, using the correct=F argument would perform a goodness of fit test and the values should be different from the test of independence. But unfortunately, I get the same values for both tests. Below is my code. I would like to understand if there is something wrong in the way I have created the dataset or in the tests I have done. The sample size is 701 and the proportions are as in the image enter image description here

data <- matrix(c(0.138,0.146,0.121,0.183,0.185,0.227), ncol=2)
colnames(data) <- c('Download', 'No Download')
rownames(data) <- c('Position_1', 'Position_2','Position_3')

as.table(data) %>% addmargins()

round(as.table(data)*701,0)%>% addmargins()

ChiData<-as.table(data)*701

#1
#Chi goodness of fit test
chisq.test(ChiData, correct = F)

#2
#Chi Test of Independence
chisq.test(ChiData)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
...