Trying to plot correlogram of time series data
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nathaniel Porter
le 19 Déc 2021
Réponse apportée : Star Strider
le 19 Déc 2021
%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 commentaires
Réponse acceptée
Star Strider
le 19 Déc 2021
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!