0
votes

I have a simple nx1 array of integers and I'd like to bootstrapping it for evaluate the confidence intervals of the proportions.

I've found a solution for IBM SPSS, but i'd like to do this analysis with matlab, you can find here the example: http://publib.boulder.ibm.com/infocenter/spssstat/v20r0m0/index.jsp?topic=%2Fcom.ibm.spss.statistics.cs%2Fbootstrap_telco_frequencies_table.htm

in Matlab I have this data, and it's from tabulation of array called c:

 Value | Count | Percent
  1      300      2.99%
  2     2928     29.16%
  3        0      0.00%
  4     3244     32.31%
  5        0      0.00%
  6     2589     25.78%
  7      980      9.76%

And I've tried to use as BOOTFUN for the bootstrap confidence interval, the following expression:

n = histc(c,unique(c))/sum(n);

I mean for n the proportions of the previous array.

Finally I use the bootci function for evaluate the intervals:

ci= bootci(1000,n,c);

I know I'm wrong in the setup of bootfun but I don't know how to fix it, and for this reason I'd like to have your help. I hope the problem is clear enough.

1

1 Answers

0
votes

You could look at something like this

>> proportions = @(x) histc(x, unique(x)) / length(x); # NB this is a function
>> x = randsample(1:6, 100, 1);        # sample with replacement from 1:6
>> ci = bootci(10000, @proportions, x) # compute 95% confidence intervals
0.0600    0.1100    0.0400    0.1700    0.1300    0.1100
0.1800    0.2700    0.1600    0.3400    0.2900    0.2500

Here your confidence intervals are (6%, 18%) for the first category, (11%, 27%) for the second category etc.