• bootstrapping中标准差计算


    根据文献,我需要的bootstrapping标准差为

    d(t)是我的原始叠加结果,b(t)是第i次bootstrapping的结果。

    而Matlab中std函数提供的标准差:

    所以直接采用std计算bootstrapping的标准差是不行的

    所以写了一个bootstrapping的标准差的脚本:

    function [boot_e] = boot_error(b_data,d)
    %calculate standard error for bootstrapping data
    %   b_data is a matrix, each sampling result is arranged in column. 
    %   b_data 是一个矩阵,每一个抽样结果按列排列。
    %   d is the observing data.
    boot_num=size(b_data,2);
    d_copy=repmat(d,[1,boot_num]);
    diff2=(d_copy-b_data).^2;
    Numerator_tmp=sum(diff2,2);
    denominator=boot_num*(boot_num-1);
    boot_e=sqrt(Numerator_tmp./denominator);
    end

     复杂一点的,防止数据中有NaN的修改一下

    function [boot_e] = boot_error(b_data,d)
    %calculate standard error for bootstrapping data
    %   b_data is a matrix, each sampling result is arranged in column. 
    %   b_data 是一个矩阵,每一个抽样结果按列排列。
    %   d is the observing data.
    boot_num=size(b_data,2);
    d_copy=repmat(d,[1,boot_num]);
    diff2=(d_copy-b_data).^2;
    Numerator_tmp=sum(diff2,2,'omitnan');
    boot_num_real=sum(~isnan(b_data), 2);
    denominator=boot_num_real.*(boot_num_real-1);
    boot_e=sqrt(Numerator_tmp./denominator);
    end
    
  • 相关阅读:
    oracle修改字符编码
    oracle修改约束列
    oracle非空约束
    Linux修改字符集
    修改oracle字符集合
    word问题禁止宏
    增加修改表列
    oracle增加sequence
    增加 修改oracle约束条件
    oracle用户 密码永不过期
  • 原文地址:https://www.cnblogs.com/shixun/p/14716261.html
Copyright © 2020-2023  润新知