How to perform t-test for a temperature anomaly data set?

9 views (last 30 days)
Hi all, let's say, I have a 376x268x235 3D matrix, with values ranging from -2.5°C to 0.65°C.
Here, 376x268 is the grid system and 235 is the time step.
I want to calculate the signal-to-noise (SNR) ratio from the composite (average) of the 235 images. Here, the signal is the mean temperature of each corresponding pixel and the noise is the variability (standard error).
Also, how can I define the statistical significance of my signal-to-noise ratio plot in a way as in I am showing a 5% significance (95% confidence level) of every pixel's SNR threshold using a one-sided Student’s t-test?
Any feedback will be greatly appreciated.

Answers (1)

Shubham
Shubham on 24 Nov 2023
Hey Ashfaq,
I understand that you want to calculate signal-to-noise (SNR) ratio using the average of 235 images and then perform the one-sided Student’s t-test with 5% significance (95% confidence).
Refer to the following code using a dummy data below:
% Dummy data generation
% 376x268x235, values ranging from -2.5 to 0.65
dummyData = -2.5 + (0.65 + 2.5) * rand(376, 268, 235);
% Calculate the Mean and Standard Error for Each Pixel
meanTemp = mean(dummyData, 3);
stdTemp = std(dummyData, 0, 3);
n = size(dummyData, 3);
seTemp = stdTemp / sqrt(n);
% Calculate the SNR for Each Pixel
snr = meanTemp ./ seTemp;
% Plot the SNR
figure;
imagesc(snr);
colorbar;
title('Signal-to-Noise Ratio (SNR)');
axis image;
I am assuming that you want to perform Student’s t-test with the null hypothesis that the data comes from normal distribution with mean equal to zero. Normally one would be using the “ttest” function given in the documentation as follows:
[h,~,~,stats] = ttest(x,0,"Alpha",0.05,"Tail","left")
Here the above line performs a t-test on sample "x" with mean 0 and 5% significance while specifying the direction for the one-sided test. The value of "hrepresents whether the null hypothesis was accepted or rejected.
In your case, the signal-to-noise ratio is stored in a matrix. We can use signal-to-noise values (t-values) for comparison with "t-critical values.
t_critical = tinv(0.95, n - 1);
statistical_Significance = abs(snr)>t_critical;
If the "t-value" lies in the bounds of t-criticalthen the null hypothesis is considered over the alternate hypothesis.
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!