Calculate and plot confidence intervals for the mean in MATLAB (bootci)

I have a set of curves that change over time, which are stored in a MATLAB matrix. Each row of the matrix is ​​one of these curves that unfolds over time. This is a repetition of a random experiment.

I need to calculate the average of these curves over time along with 95% confidence intervals.

My understanding of statistics is pretty poor, but they suggested that I use bootstrap confidence intervals using the MATLAB bootci function.

I have implemented a minimal example in MATLAB, but I have some doubts. Hope you can help me better understand this and avoid stupid mistakes.

Here is an example:

NVARIABLES = 200;
NOBSERVATIONS = 1000;
RESAMPLING = 10000;

DATA = rand(NOBSERVATIONS, NVARIABLES);

[CI, STAT] = bootci(RESAMPLING, @mean, DATA);

MEAN = mean(DATA); % <------- [1]

x = 1:NVARIABLES;

figure;
hold on;
plot(x, MEAN, 'LineWidth', 2);
plot(x, CI(1,:), '--', 'LineWidth', 2); % [2]
plot(x, CI(2,:), '--', 'LineWidth', 2);
% plot(x, MEAN-CI(1,:)); % ?
% plot(x, MEAN+CI(2,:)); % ?
hold off;

Here are my questions:

  • Am I using the function correctly?
  • / (DATA) (. 1), ? , STAT , ,
  • , (. [2]), MEAN-CI (1,:) MEAN + CI (2,:)?

, , .

enter image description here

+4
1

Q1 Q3.

Q1. , , - , , , - , . , , .

Q3. , , - CI , . , . plot_ci - , . ( , ): Confidence Interval Configuration

:

plot_ci(x,[MEAN,CI(1,:),CI(2,:)],'PatchColor', 'k', 'PatchAlpha', 0.1, 'MainLineWidth', 2, 'MainLineStyle', '-', 'MainLineColor', 'b','LineWidth', 1.5, 'LineStyle','--', 'LineColor', 'k');
+3

Source: https://habr.com/ru/post/1626668/


All Articles