genomicsclass / labs

Rmd source files for the HarvardX series PH525x
http://genomicsclass.github.io/book
MIT License
2k stars 1.94k forks source link

different result of t.test in type II error simulation #94

Closed wahyudinnasrulloh closed 4 years ago

wahyudinnasrulloh commented 4 years ago

Hi, Prof. Rafa! I'm using R 3.6.3 version and doing some false negative demonstration based on edX PH525x course. i'm using exactly same code with the lecture video and the book. Here is it ` dat <- read.csv("mice_pheno.csv")

controlPopulation <- filter(dat,Sex == "F" & Diet == "chow") %>% select(Bodyweight) %>% unlist

hfPopulation <- filter(dat,Sex == "F" & Diet == "hf") %>% select(Bodyweight) %>% unlist

mu_hf <- mean(hfPopulation) mu_control <- mean(controlPopulation)

mu_hf - mu_control [1] 2.375517 (mu_hf - mu_control)/mu_control * 100 # percent increase [1] 9.942157 ' So far the result still the same with the video. After that: ' set.seed(1) N <- 5 hf <- sample(hfPopulation,N) control <- sample(controlPopulation,N) t.test(hf,control)$p.value the result supposed to be0.1410204, but my result is0.5806661`. I retried for several times and several generating value method, but the result hasn't changed.

Seeing that this material was last edited 4 years ago, then I think that there is a logarithmic difference in the 'set.seed()' function.

Glad if you help me

vjcitn commented 4 years ago

Please say exactly where you find the result given as 0.1410204 - please give a URL that shows exactly where it can be found. If it is an exercise solution in edx give the full URL and name of section and subsection. Thank you.