Bootstrapping matrixes jointly
이전 댓글 표시
I have a question about bootstrapping. I have to generate bootstrapped samples in Matlab. I have found one way to do it. For example I have matrix A.
A = [ 1 2 3; 4 5 6; 7 8 9]
To obtain one bootstrapped sample I do :
s=size(A); % I calculate the dimensions of A
out=A(ceil(s(1)*s(2)*rand(s(1),s(2),1))); % then I randomly draw the observations from A to construct the bootstrapped sample.
It seems to work pretty well. But to solve my problem, I have to draw the samples from several matrixes jointly.
What I mean is: For example, I have two matrixes.
A = [1 2 ; 3 4] and B = [5 6; 7 8]
The dimensions of the matrixes are firms and time periods ( 2 firms, 2 time periods here). I have the data on characteristics ( A and B) for these firms, which are presented by matrixes above.
Here the columns are time periods and rows are firms.
So 2 (element (1,2)) is the characteristic A of the first firm in second period and 6 (element(1,2)) is the corresponding characteristic B.
When I do bootstrapping, and draw the observations from these matrixes to construct other two samples, I need that they are drawn jointly. So if I randomly draw 2 from the A matrix to form bootstrapped A matrix, I should draw 6 from the B matrix to form bootstrapped B matrix at the same time. So that each element of a bootstrapped matrix of A and bootstrapped matrix of B belonged to the same firm and time period. Is there any possibility to do it? Thanks a lot for any help in advance!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!