Trying to plot correlogram of time series data
26 次查看(过去 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!