Question: Create a function in R program that performs a general pairwise test for the difference in the average value of two sets of numerical data.
Create a function in R program that performs a general pairwise test for the difference in the average value of two sets of numerical data. The function should take two vectors of numbers x and y as input. To simplify operation the test should only make a one-side test that one sample has a greater average value than the other.
my.onesideddiff.test <- function(x,y) { -
# check samples sizes
-
# check normality if required
-
# select the relevant t test or Mann-Whitney U test
-
# return at least the name of the test selected and its p-value }
Be sure to consider all cases, e.g., of equal and unequal variance, where relevant.
Show that your code produces the same results as performing the relevant individual test in r for sufficient synthetic data examples (i.e., devise samples that test each option at least once, but there is no need to test all combinations).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
