How to find distribution of the data?
조회 수: 16 (최근 30일)
이전 댓글 표시
Hello,
I have a code that i calculate pairwise distances of points belonging to same grid on a map. Now, I want to know if those distances are very close to each other or not. In other words, I want to find if these distances in every grid are distributed normally, lognormally or not. I calculated the standard deviation of distances in every grid. But I dont know how to understand if my data is normally distributed in every grid or not.
Here you can find my code and data.
clear all;
addpath('D:\Desktop\BOUN\JOB\Slip_Rates\Slip_Data\MAP');
LAT1=39;LAT2=42;LON1=29.0;LON2=41.0;
sf = 1;
m_proj('albers equal-area','lat',[LAT1 LAT2],'long',[LON1 LON2],'rect','on');m_gshhs_h('color',[.5 .5 .5]);hold on;
m_grid('linewi',1,'linest','none','tickdir','in','fontsize',10);
all = load('all_velocities.txt');
lon1=all(:,1);lat1=all(:,2);ve1=all(:,3);vn1=all(:,4);
% GRIDDING THE AREA
dLO = .5*2; dLA = .3636*2;
lon = [LON1:dLO:LON2];
lat = [LAT1:dLA:LAT2];
% DENSITY OF THE PLOTS & DISTANCES IN EVERY GRID
nlat = length(lat);
nlon = length(lon);
DIST = cell(nlat, nlon);
for i = 1:nlat
for j = 1:nlon
ind = find(abs(lat1-lat(i))<dLA/2 & (abs(lon1-lon(j))<dLO/2)); % FINDING ELEMENTS BELONGING O GRIDS
DENSITY(i,j) = length(ind); % WHICH GRID CONTAINS WHAT AMOUNT OF ELEMENT
points = [reshape(lat1(ind),[],1), reshape(lon1(ind),[],1)];
P{i,j} = points;
DIST{i,j} = pdist(points, 'euclidean'); % FINDING THE DISTANCE BETWEEN ELEMENTS BELONGING TO SAME GRID
end
end
% STANDARD DEVIATION OF THOSE DISTANCES
for i = 1:nlat
for j = 1:nlon
SDIST(i,j) = std(DIST{i,j});
end
end
% PLOT
m_pcolor(lon-dLO/2,lat-dLA/2,DENSITY);colormap(jet);colorbar;
m_quiver(lon1,lat1,sf.*ve1,sf.*vn1,1,'w','filled','AutoScale','off','linewidth',1.5);
hold off;
댓글 수: 0
채택된 답변
Jemima Pulipati
2020년 12월 22일
Hello,
From my understanding you want to check if the given data is normally distributed or not.
The chi2gof(x) returns a test decision for the null hypothesis that the data in vector x comes from a normal distribution with a mean and variance estimated from x, using the chi-square goodness-of-fit test. The alternative hypothesis is that the data does not come from such a distribution. The result is 1 if the test rejects the null hypothesis at the 5% significance level, and 0 otherwise.
Some of the answers from the community which might be of relevance to you:
댓글 수: 0
추가 답변 (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!