Again, just like last time it is wise to start with fixing the random seed.
set.seed(123)
n numbers from a normal distribution with a user defined mean (i.e. a mean that you can choose when running the function) and standard deviation 1, and returns the p.value for the test that the mean is 0.qqplot to compare distribution of the \(p\)-values with a uniform \([0,1]\) variable.In a study that examined the use of acupuncture to treat migraine headaches, consenting patients on a waiting list for treatment for migraine were randomly assigned in a 2:1:1 ratio to acupuncture treatment, a “sham” acupuncture treatment in which needles were inserted at non-acupuncture points, and waiting-list patients whose only treatment was self-administered (Linde et al., 2005). The “sham” acupuncture treatment was described to trial participants as an acupuncture treatment that did not follow the principles of Chinese medicine.
Use the following data
data <- matrix(c(74, 71, 43, 38, 11, 65), nrow = 2, ncol = 3)
colnames(data) <- c("Acupuncture", "Sham", "Waiting list")
rownames(data) <- c("> 50% reduction", "< 50% reduction")
data
## Acupuncture Sham Waiting list
## > 50% reduction 74 43 11
## < 50% reduction 71 38 65
data <- matrix(c(82, 17, 30, 30, 26, 16), nrow = 3, ncol = 2)
colnames(data) <- c("Acupuncture", "Sham")
rownames(data) <- c("Chinese", "Other", "Don't know")
data
## Acupuncture Sham
## Chinese 82 30
## Other 17 26
## Don't know 30 16
chisq.test() or the fisher.test(). Create the function such that it:bacteria (from MASS) by testing independence between compliance (hilo) and the presence or absence of disease (y).bacteria dataset?End of practical.