From 6eb711beb4a789d262fcd791b6a0bb1f19064fc1 Mon Sep 17 00:00:00 2001 From: Hui Lan Date: Thu, 11 Apr 2019 09:26:58 +0800 Subject: Initial commit Lecture Notes on Artifical Intelligence --- smallPValueCanAriseByChance.R | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 smallPValueCanAriseByChance.R (limited to 'smallPValueCanAriseByChance.R') 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 -- cgit v1.2.1