Matrix Input to bootci

4 views (last 30 days)
Matt
Matt on 13 Jan 2015
Answered: Matt on 13 Jan 2015
According to the documentation for bootci , the input data can be a matrix, and the function will compute a confidence interval over the rows. So for example, if my input data is:
>> X = randn(10,200,4);
the expected behavior of the function is that it should output a matrix that is [2 200 4] (lower/upper bounds for each of the 200x4 data).
However, when I call the function:
>> ci = bootci(1000,{@nanmean,X},'alpha',0.05,'type','norm');
I get an error:
Error using bsxfun
Non-singleton dimensions of the two input arrays must match each other.
Error in bootci>bootnorm (line 190)
bias = mean(bsxfun(@minus,bstat,stat),1);
Error in bootci (line 161)
[ci,bootstat] = bootnorm(obsstat,nboot,fun,alpha,weights,bootstrpOptions,data{:});
Possibly related, the output of the function with a 2D matrix is also unexpected given the documentation:
>> X = randn(10,200);
>> ci = bootci(1000,{@nanmean,X},'alpha',0.05,'type','norm');
>> size(ci)
2 10
If the function were operating on the rows (as it says in the help file), it should give a [2 200] output.
Has anyone noticed this behavior and/or gotten it to work properly in both cases?
Thanks,
Matt

Accepted Answer

Matt
Matt on 13 Jan 2015
EDIT: Problem solved. I had an external version of nanmean in my path. The built-in function works as expected.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!