Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Different t.test result in type II error simulation #95

@isaid-hi

Description

@isaid-hi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions