How do you force bootci to keep a constant bootstrapping sample size?

2 次查看(过去 30 天)
Consider the code below:
function [ci,bootstat] = bootstrap_test ()
% simulate data
y = normrnd(10,1,5,1);
% run bootci
[ci,bootstat] = bootci(10, @calc_mu_sigma, y);
%%func
function [ output ] = calc_mu_sigma( a )
% display size of bootstrapping sample
disp(size(a))
% calculate output and assign
mu = mean(a);
sigma = std(a);
output = [ mu, sigma ];
end
end
Here the subfunction is the bootfun as defined here, bootci crease bootstrapping samples 'a' which it then passes to calc_mu_sigma (the bootfun).
However 'a' changes size from 5x1 to 4x1, I need a to always stay the same size as I need to pass bootci three vectors of different sizes. A bootfun will not receive three vectors of different sizes so I was planning on contacting them together, passing their sizes to the bootfun then unpacking them inside the bootfun back into their original form, however if their concatenated form changes size then there is no way I can know where one of my original vectors ends and the next begins. I would very much appreciate some guidance here, many thanks in advance.

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by