rboot.m

来自「一个非常实用的统计工具箱」· M 代码 · 共 33 行

M
33
字号
function z = rboot(x,B)%RBOOT    Simulate a bootstrap resample from a sample.%%	  Z = rboot(X)%%	  Give a resample of the same size as X, which is assumed%	  to have one independent realisation in every row.%	  RESAMPLE(X,B) gives B columns of resamples. This form works%	  only for X one-dimensional, ie X column vector.%       Anders Holtsberg, 14-12-94%       Copyright (c) Anders Holtsbergif min(size(x)) == 1   x = x(:);endif nargin > 1 & size(x,2) > 1   if B > 1, error('X multidimensional and B > 2'), endelseif nargin < 2   B = 1;endn = size(x,1);nn = n*B;I = ceil(n*rand(nn,1));if B > 1   z = zeros(n,B);   z(:) = x(I);else   z = x(I,:);end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?