genomicsclass/labs

different result of t.test in type II error simulation

Closed this issue · 1 comments

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 is 0.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

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.