Normality test temperature data
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a column of temp data - some neagative values.
I applied a KS and lillietest to the data - it is NOT normally distributed.
As data has negative values, I can't apply a log transform.
Even if I apply log transform, the data takes on non-real values e.g. 5.21493575760899 + 3.14159265358979i
Any ideas how I can transform the data to make it normally distributed?
Nothing too complicated - I am a beginner.
Thank you.
1 个评论
dpb
2019-12-15
编辑:dpb
2019-12-15
"Any ideas how I can transform the data to make it normally distributed?"
W/O any idea of what the data looks like, no.
But, there may be no need...what is end objective?
However, if you feel compelled the Box-Cox transformation is one common technique that is pretty general. See <NIST handbook EDA Box-Cox Transformation>
回答(1 个)
Ridwan Alam
2019-12-15
编辑:Ridwan Alam
2019-12-15
Since linear shift won't affect the distribution, you can shift the data and perform log transformation.
%% test data
data = randn(1000,1);
data = data - min(data) + 1;
% making sure that the data is not normal
data = exp(data);
% also, since your data has many negative values
data = data - 0.9*max(data);
lillietest(data) % ans = 1
% LOG TRANSFORMATION
% first, shift your data to all positive range
posdata = data - min(data) + 1;
lillietest(posdata) % ans = 1
% then, perform log transformation
logdata = log(posdata);
lillietest(logdata) % ans = 0
Hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Hypothesis Tests 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!