Skip to content

Commit 9015771

Browse files
Merge pull request #734 from nmfs-ost/bootstrap-sample-sizes
fix bootstrap sample size issue for size frequency data
2 parents 0284c23 + f916f3a commit 9015771

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

SS_write_ssnew.tpl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,9 @@ FUNCTION void write_nudata()
13441344
for (iobs = 1; iobs <= SzFreq_totobs; iobs++)
13451345
{
13461346
f = SzFreq_obs1(iobs, 1); // sizefreq method
1347+
// maximum sample size for bootstrapping is 50000
13471348
double Nsamp_dat = 50000;
1349+
// set sample size
13481350
if (SzFreq_obs1(iobs, 7) < Nsamp_dat)
13491351
Nsamp_dat = SzFreq_obs1(iobs, 7);
13501352
SzFreq_newdat.initialize();
@@ -1376,10 +1378,12 @@ FUNCTION void write_nudata()
13761378
break;
13771379
}
13781380
}
1379-
1381+
// get probabilities for this observation
13801382
temp_probs3(1, SzFreq_Setup2(iobs)) = value(SzFreq_exp(iobs));
1383+
// generate a vector of multinomial random variables (bin numbers)
13811384
temp_mult.fill_multinomial(radm, temp_probs3(1, SzFreq_Setup2(iobs))); // create multinomial draws with prob = expected values
1382-
for (compindex = 1; compindex <= j; compindex++) // cumulate the multinomial draws by index in the new data
1385+
// increment the new data vector by bin number
1386+
for (compindex = 1; compindex <= Nsamp_dat; compindex++) // cumulate the multinomial draws by index in the new data
13831387
{
13841388
SzFreq_newdat(temp_mult(compindex)) += 1.0;
13851389
}

0 commit comments

Comments
 (0)