【问题标题】:bootstrap data in confidence interval MATLAb置信区间 MATLAb 中的引导数据
【发布时间】:2013-10-28 10:13:48
【问题描述】:

我也试过这个:

plot(x(bootsam(:,100)),y(bootsam(:,100)), 'r*') 但它与我的数据完全相同!我想以 95% 的置信区间重新采样我的数据。 但似乎这个命令 bootstrp 不能单独工作,它需要一些功能或其他命令组合。你能帮我弄清楚吗?

我想随机生成一些数据,但在原始数据周围表现得像我的函数,我附上了一个图,其中原始数据为红色,重新采样的数据为蓝色和绿色。

一般来说,我想使用引导程序来查找我最适合的参数的错误。我在这本书中读到: http://books.google.de/books?id=ekyupqnDFzMC&lpg=PA131&vq=bootstrap&hl=de&pg=PA130#v=onepage&q&f=false 其他误差分析方法我的拟合参数表示赞赏。

【问题讨论】:

  • 你试过这个以及什么?这是前面问题的后续吗?你想做什么?
  • 我已经给了你一个answer,但我认为你想要什么还不是很清楚。你能透露一下你到底在做什么吗?
  • 非常感谢@francesco,我阅读了您的回答并感谢您的考虑。我试图重新解释我想要什么。
  • 那么为了确定这个值的不确定性,我们必须执行以下程序。 – 我们应该给每个数据点打上标签,比如a1; a2; :::;一个。 – 我们必须为每个数据点添加一个随机数生成器。随机生成器应该是一个高斯随机生成器,其均值为零,所有数据点的平均误差宽度。 – 然后我们必须重新计算参数的值 – 我们必须对大数重复上述过程

标签: matlab statistics-bootstrap


【解决方案1】:

我建议你以这种方式开始,然后根据你的情况进行调整。

% One step at a time.
% Step 1: Suppose you generate a simple linear deterministic trend with
% noise from the standardized Gaussian distribution:
N = 1000;    % number of points
x = [(1:N)', ones(N, 1)];    % x values
b = [0.15, 157]';    % parameters
y = x * b + 10 * randn(N, 1);    % linear trend with noise
% Step 2: Suppose you want to fit y with a linear equation:
[b_hat, bint1] = regress(y, x);    % estimate parameters with linear regression
y_fit = x * b_hat;    % calculate fitted values
resid = y - y_fit;    % calculate residuals
plot(x(:, 1), y, '.')    % plot
hold on
plot(x(:, 1), y_fit, 'r', 'LineWidth', 5)    % fitted values
% Step 3: use bootstrap approach to estimate the confidence interval of
% regression parameters
N_boot = 10000;    % size of bootstrap
b_boot = bootstrp(N_boot, @(bootr)regress(y_fit + bootr, x), resid);    % bootstrap
bint2 = prctile(b_boot, [2.5, 97.5])';    % percentiles 2.5 and 97.5, a 95% confidence interval
% The confidence intervals obtained with regress and bootstrp are
% practically identical:
bint1
bint2

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-29
    • 1970-01-01
    • 2011-11-27
    • 2016-11-28
    • 1970-01-01
    • 2018-10-02
    • 1970-01-01
    相关资源
    最近更新 更多