Improper bootstrap sampling in VARLiNGAM
Hi @ikeuchi-screen,
I think the bootstrap method in VARLiNGAM uses the residuals from each iteration to resample rather than resampling from the original residuals: https://github.com/cdt15/lingam/blob/1495ba515024a27d0ea0cabbc2e15d4aee76823a/lingam/var_lingam.py#L155
As a result the draws are not independent.
Happy to send a pull request for that as well if you wish.
Hi @paullabonne ,
I'm sorry, but I don't understand the points of the feedback. Could you please explain what code modifications are necessary?
Thank you for the pull request! https://github.com/cdt15/lingam/pull/162
In each draw of the bootstrap, the model is re-estimated with https://github.com/cdt15/lingam/blob/1495ba515024a27d0ea0cabbc2e15d4aee76823a/lingam/var_lingam.py#L173
and if I am correct it is the residuals from this estimation which are used for resampling in https://github.com/cdt15/lingam/blob/1495ba515024a27d0ea0cabbc2e15d4aee76823a/lingam/var_lingam.py#L155
So each draw is dependent on the previous draw. So for instance if one round of estimation is bad it will contaminate all the following draws. My understanding of bootstrapping is that each draw should be independent and sampled from the original residuals, which here should be the one from https://github.com/cdt15/lingam/blob/1495ba515024a27d0ea0cabbc2e15d4aee76823a/lingam/var_lingam.py#L145
Storing the residuals from L145 and using those in resample() instead of self._residuals should work, see https://github.com/cdt15/lingam/commit/e8196a7a6db5e2d0d105f9b865db3f9f894db628
Thanks for the detailed explanation. I now understand what needs to be corrected!