Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ab 4: Power of the Chi-Squared Test Building on what we have learned recently about power of hypothesis tests, we are going to take a
ab 4: Power of the Chi-Squared Test Building on what we have learned recently about power of hypothesis tests, we are going to take a look at the power of the chi-squared test for association between two binary variables. Following some of the examples we have seen, we'll generically call the two variables exposure and disease. To start, your group should simulate a data table based on n = 100 individuals, where each individual has the following probabilities of falling into each cell. Exposure Y N Disease Y 0.15 0.10 N 0.45 0.30 You can simulate the dataset using the commands mydata <- matrix(rmultinom(1, size=100, prob=c(0.15, 0.45, 0.1, 0.3)), nrow=2) mydata The rmultinom function in R simulates random draws from the multinomial distribution, which generalizes the binomial distribution from two categories (e.g., success/failure) to more than two categories (we need four right, for the four cells in our table). Also if you are curious about about why the rst argument we supply to the rmultinom function is a 1, this is because we seek only 1 simulated set of four counts. Now carry out the chi-squared test to see if your dataset casts doubt on the null hypothesis that exposure
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started