samedi 25 mai 2019

I need to run a fisher test for each of my school

My goal is to run a fisher's test for each of my school and store the assigned p-value. Taking into account the issues related to the workspace for a fisher's test, I run a simulated pvalue. My problem is in the loop (I think so) because the final p-value for each of my schools is the same. I think that my code is not right resulting in a overall estimated p-value. I do something wrong with the loop but what? Can you give me some feedbacks?

`getwd() setwd("C:/Users/User/Desktop/Test_Fisher") mydata <- read.csv("C:/Users/User/Desktop/Test_Fisher/test.csv", header = TRUE)

fishert <- numeric() for (id_scuola in 1:5000) fishert[id_scuola] <- fisher.test(mydata$g8_ethnic_rec, mydata$id_classe_test, simulate.p.value = TRUE, B = 1000)$p.value

print(fishert)`

I do not have errors but look at the following print. I run the loop with few schools. The p-value is the same for each school.

[501] 0.000999001 0.000999001 0.000999001 0.000999001 0.000999001 0.000999001 0.000999001 0.000999001 0.000999001 0.000999001

Aucun commentaire:

Enregistrer un commentaire