Trying to plot correlogram of time series data
24 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nathaniel Porter
el 19 de Dic. de 2021
Respondida: Star Strider
el 19 de Dic. de 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 comentarios
Respuesta aceptada
Star Strider
el 19 de Dic. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!