A small bug in GenericLikelihoodModelResults.bootstrap() #1434

herrlich10 opened this Issue Feb 27, 2014 · 4 comments


None yet

2 participants


I guess line 1917 of statsmodels / base / model.py
rvsind = np.random.randint(self.nobs - 1, size=self.nobs)
should be
rvsind = np.random.randint(self.nobs, size=self.nobs).

Otherwise the last observation would never be sampled.


Thanks for catching this. clearly a bug

( the bootstrap is experimental, because we need to add a more general method for it, that allows a choice of bootstrap type.)


statsmodels is a very usefully package, filling the gap between python and statistics beyond high school. (rpy2 and R might be a bit too esoteric to average user like me...) I hope it will become more full-fledged.

I used GenericLikelihoodModel to fit psychometric function (essentially a modified logistic regression with lower and upper asymptotes other than 0 and 1), and implemented parametric and non-parametric bootstrap methods accordingly. But I found it not easy for me to make the code more generic in order to be useful to others.


BTW, shall I close this issue for now?


@herrlich10 No, don't close this issue, I still need to fix this.

About your application: If you are willing to publish it, it would still make a good example, either to be converted to a notebook documentation example, https://github.com/statsmodels/statsmodels/wiki/Examples , or as an example that can eventually be converted to a supported model class.
To the latter: I think it would be useful to get a collection of common non-linear models, and logistic regression, without the 0, 1 probability assumption as in discrete Logit, would be a good candidate. IIRC there are at least a few stackoverflow examples for this.

@josef-pkt josef-pkt added this to the 0.6 milestone Jul 16, 2014
@josef-pkt josef-pkt referenced this issue Sep 22, 2014

release 0.6 #912

11 of 25 tasks complete
@josef-pkt josef-pkt closed this in 4d56aa0 Sep 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment