diff options
Diffstat (limited to 'smallPValueCanAriseByChance.R')
-rw-r--r-- | smallPValueCanAriseByChance.R | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/smallPValueCanAriseByChance.R b/smallPValueCanAriseByChance.R new file mode 100644 index 0000000..8c69f90 --- /dev/null +++ b/smallPValueCanAriseByChance.R @@ -0,0 +1,11 @@ +# Purpose: "we expect to see approximately five small p-values even in the absence of +# any true association between the predictors and the response" +# Created by Hui Lan on 19 April 2018 (zjnu) +N <- 200 # number of data points +p <- 100 # number of dimensions +X <- cbind(rep(1,N), matrix(rnorm(N*p), N, p)) +beta = matrix(c(12, rep(0, p)), p+1, 1) +y = X %*% beta + rnorm(N,0,0.5) # H0 is true + +model <- lm(y ~ X) +summary(model)
\ No newline at end of file |