Jenny, a probability student, having seen Example 2.6 and its solution, becomes convinced that it is a nearly even bet that someone among the next 22 people she meets randomly will have the same birthday as she does. What is the fallacy in Jennys thinking? What is the minimum number of people that Jenny must meet before the chances are better than even that someone shares her birthday?
# 9.26 # Variable selection (step wise selection) (Ch6) data=read.csv(file.choose()) data=data[-1] # x1:x7 are quantative factors # We will try to use all 7 independent varibales (predictors) to predict y (exclude the first column) m1=lm(y~.,data) # m1 is not adequate to predict y # Before fitting regression, check correlations first cor.test(data[,2], data[,3])$p.value cor.test(data[,2], data[,4])$p.value cor.test(data[,2], data[,5])$p.value cor.test(data[,2], data[,6])$p.value cor.test(data[,2], data[,7])$p.value # non is significant # try to apply coding procedure to minimize the standard error # create a new matrix and store the coding procedure variables data1=matrix(0,nrow(data), 8) for (j in 2:9){ data1[,j-1]=(data[,j]-mean(data[,j]))/sd(data[,j])