gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
non inferiority z-test in R for two independent proportions in R
- User
non inferiority z-test in R for two independent proportions in R
- Assistant
To perform a non-inferiority z-test for two independent proportions in R, you can use the "prop.test" function. Here's an example:
# Number of successes and total observations for Group 1 successes1 <- 80 total1 <- 100 # Number of successes and total observations for Group 2 successes2 <- 75 total2 <- 100 # Null hypothesis: p1 - p2 >= delta (non-inferiority margin) delta <- 0.05 # Perform non-inferiority test prop.test(x = c(successes1, successes2), n = c(total1, total2), alternative = "less", conf.level = 0.95, correct = FALSE, p.adjust.method = "none")Explanation of the code:
- You need to specify the number of successes and total observations for each group.
- Define the non-inferiority margin (delta), which represents the threshold of difference you consider acceptable.