Hi Seldeeno,
Yes, you need to perform a "t-test" in MATLAB using summary statistics, using means, standard deviations, and sample sizes of both groups.
The following steps can be followed for performing the “t-test”:
- Define the means, standard deviations, and sample sizes for both groups.
- Conduct an "F-test" to determine whether the variances of the two groups are similar. This will help decide whether to use the standard "t-test" assuming equal variances or opt for Welch's t-test if the variances differ.
- Calculate the t-statistic and determine degrees of freedom.
- Compute the p-value to evaluate the statistical significance of the difference between the groups.
The following piece of code demonstrates a part of the problem:
pValueF = 2 * min(fcdf(F, df1, df2), 1 - fcdf(F, df1, df2));
equalVar = pValueF > alpha;
sp = sqrt(((n1 - 1) * std1^2 + (n2 - 1) * std2^2) / (n1 + n2 - 2));
tStat = (mean1 - mean2) / (sp * sqrt(1/n1 + 1/n2));
tStat = (mean1 - mean2) / sqrt((std1^2/n1) + (std2^2/n2));
df = ((std1^2/n1 + std2^2/n2)^2) / (((std1^2/n1)^2 / (n1 - 1)) + ((std2^2/n2)^2 / (n2 - 1)));
The following functions are helpful while performing the statistical calculations:
- “fcdf()”: Computes the cumulative distribution function for the F-distribution
- "sqrt()": Calculates the square root
- "tcdf()": Computes the cumulative distribution function for the t-distribution