I'm trying to implement a bootstrap method to obtain confidences intervals of a fitted logistic curve.
I've been learning a lot because I'm new to these things, so I ask forgiveness if the question is too broad or if it's too simple.
the setup is the following: For each fixed X values, there are 10 different answers Y given, that can only be 0 or 1. From these answers a performance is calculated in the following way: before a certain X the correct answer is 0, and after is 1.
The performance ranges from 0 to 1, and it's fitted with a logistic function.
Now, I need to compare different fitting for different setups, for this reason I'm trying to implement a bootstrap method (after failing to implement it using matlab functions), but I am not sure if the result I get follows a procedure that is statistically correct.
The procedure I did is the following: I generated 20.000 random set of performances (that will generate different fit), keeping X constant, but random sampling Y with replacement.
For example, having associated to X the following "real" answers:
X(1) => Y_real(1) = [0 0 0 0 0 1 0 0 0 0] ... X(n) => Y_real(n) = [1 1 1 1 1 0 1 1 1 0]
I generate (20000 times separately)
X(1) => Y_2(1) = [ ... ] ... X(n) => Y_2(n) = [ ... ]
where for each Y_2(n) I sample from Y_real(n), with repetition (function randsample of matlab)
Obtaining in the end a matrix of:
number of X * 10 (number of answers) * 20000
From this I obtain 20000 different fits, and I use them to obtain confidences and compare different setups (so e.g. meanA(20000) vs meanB(20000), where A and B are different initial setups, that generated different data).
Is the procedure correct? Should I be using a different method?
- the performance should be a probability
- the curve is fit using glmfit .. 'binomial','link','logit'
Many thanks in advance, I hope I was clear enough.