Trying to plot correlogram of time series data
33 ビュー (過去 30 日間)
古いコメントを表示
%Plot of entire patient one time series
load ('glucose.mat')
glucose_mgdl = glucose * 18;
plot(date1+time,glucose_mgdl),
xlabel('Days'), ylabel('Glucose')
title('Glucose readings vs days/time')
M = mean(glucose_mgdl)
S = std(glucose_mgdl)
%now get the PDF
figure
[D PD] = allfitdist(glucose_mgdl,'PDF');
xlabel('Data (mgdL)');
%now get the CDF
figure
[D PD] = allfitdist(glucose_mgdl,'CDF');
xlabel('Data(mgdL)')
%Plot of correlogram
r = xcorr(date1+time,glucose_mgdl)
0 件のコメント
採用された回答
Star Strider
2021 年 12 月 19 日
Essentially all physiological variables are lognormally distributed. This is inutitively obvious because physiological variables can only take on positive values (so any distributions having infinite support are not applicable), and mathematically obvious by comparing the fit to a normal (or any other) and lognormal distribution, and can be supported mathematically with appropriate goodness-of-fit tests.
Calculating and plotting the autocorrelation is the best I can do with those data.
I also corrected the distribution —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/838690/glucose.csv', 'VariableNamingRule','preserve')
d_t = T1.date+T1.time;
Glc = T1.glucose;
figure
plot(d_t, Glc)
grid
xlabel('Time')
ylabel('Plasma GLucose (m\itM\rm)')
title('Original Data')
Glcmx = Glc == max(Glc); % Detect Saturation ('Railed') Data
Glce = Glc(~Glcmx); % Eliminate Saturation ('Railed') Data
d_te = d_t(~Glcmx); % Eliminate Saturation ('Railed') Data
figure
plot(d_te, Glce, '.')
grid
xlabel('Time')
ylabel('Plasma GLucose (m\itM\rm)')
title('Data Without Saturated Values')
figure
histfit(Glce, ceil(numel(Glce)/10), 'lognormal')
grid
pd = fitdist(Glc, 'lognormal')
Glcmode = mode(Glce)
Glcmedian = median(Glce)
[r,lags] = xcorr(Glce,'coeff');
figure
plot(lags, r, '.')
grid
xlabel('Lags')
ylabel('Croorelation Coefficient')
title('Autocorrelation')
.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!