Extending Two Sample Mean Test for Arrays
In the previous blog, I implemented a Two Sample Mean hypothesis test with Excel LAMBDA.
In this blog, I will create a new function that takes in two sample data arrays directly, calculate the necessary statistics, and then reuse the Two Sample Mean function to perform the hypothesis test.
This approach will ensure the same result.
Parameter Changes
In the earlier implementation, the dcrMean.Two.TTest input parameters are:
dcrMean.Two.TTest =LAMBDA(sample_mean_1, sample_stdev_1, sample_size_1, sample_mean_2, sample_stdev_2, sample_size_2, [tail], [show_details],
To take in two arrays, I will create a new function dcrMean.Two.TTest.Array with input parameters as follows:
dcrMean.Two.TTest.Array =LAMBDA(array_1, array_2, [tail], [show_details],
Within this new function, the mean and standard deviation of the two input arrays will be pre-calculated before passing the values into the hypothesis test. The implementation will be like this:
=LAMBDA(array_1, array_2, [tail], [show_details], LET(tail, IF(ISOMITTED(tail), 0, tail), show_details, IF(ISOMITTED(show_details), FALSE, show_details), sample_mean_1, AVERAGE(array_1), sample_stdev_1, STDEV.S(array_1), sample_size_1, COUNT(array_1), sample_mean_2, AVERAGE(array_2), sample_stdev_2, STDEV.S(array_2), sample_size_2, COUNT(array_2), dcrMean.Two.TTest(sample_mean_1, sample_stdev_1, sample_size_1, sample_mean_2, sample_stdev_2, sample_size_2, tail, show_details) ) )
This should be easy. Try it yourself in DC-DEN!
Comments
Post a Comment