How can I use bootstrapping with different sized data sets?
1 次查看(过去 30 天)
显示 更早的评论
I wish to use MATLAB's bootstrapping functionality, however my data sets are of different sizes. See the code below as an example of what I would like to be able to do:
function [ci,bootstat] = bootstrap_test ()
clc
clear
close all
% simulate data
y = normrnd(0,1,100,1);
z = normrnd(100,2,200,1);
% run bootci
[ci,bootstat] = bootci(5, @calc_mu_sigma, y, z);
%%func
function [ output ] = calc_mu_sigma( a, b )
% calculate output and assign
mu_1 = mean(a);
sigma_1 = std(a);
mu_2 = mean(b);
sigma_2 = std(b);
output = [ mu_1, sigma_1, mu_2, sigma_2 ];
end
end
I understand this is not possible using this function, however is there an alternative method that I could implement? In my actual script both data sets are required to be present within the bootstrapping function, obviously this is not the case in this code.
1 个评论
jgg
2016-1-27
Why, exactly, are you trying to bootstrap two datasets at once? That seems very odd. It also seems to be the root of your problem, rather than the fact they have different sample sizes. The bootstrap procedure is designed to creature CI for your data; it cannot possibly come up with correct CI for datasets of different sizes being drawn together, since the empirical likelihood of sampling a given value for either is quite different.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!