How to perform t-test for a temperature anomaly data set?
7 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
Shubham
2023-11-24
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 "h” represents 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-critical” then the null hypothesis is considered over the alternate hypothesis.
Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!