> #Problem 3.54 > z <- c(2.5,0,3.7,-0.6,1.7,0,5.9,4.6,0,-1.4,5.4,4.6,3.1,-2,6.3) > z1 <- z[z!=0] > B1 <- sum(z1>0) > B1 [1] 9 > n1 <- length(z1) > n1 [1] 12 > B2 <- sum(z>0) > B2 [1] 9 > n2 <- length(z>0) > n2 [1] 15 > #(i)Test with discarding zeros > binom.test(B1, n1, p=0.5, alternative="greater") Exact binomial test data: B1 and n1 number of successes = 9, number of trials = 12, p-value = 0.073 alternative hypothesis: true probability of success is greater than 0.5 95 percent confidence interval: 0.4726734 1.0000000 sample estimates: probability of success 0.75 > #(ii)Test with zeros being negative > binom.test(B2, n2, p=0.5, alternative="greater") Exact binomial test data: B2 and n2 number of successes = 9, number of trials = 15, p-value = 0.3036 alternative hypothesis: true probability of success is greater than 0.5 95 percent confidence interval: 0.3595652 1.0000000 sample estimates: probability of success 0.6 > #p-value for (i) is 0.073 and (ii) is 0.3036 > #The p-value for the conservative method (ii) is more than > #four times larger and therefore harder to reject than (i).