Navigation Banner
  next up previous
Next: The Parametric Bootstrap: parboot.bf Up: Simulation Tools Previous: Simulation Tools

The Bootstrap: bootstrap.bf

The bootsrap provides, among other things, a simple nonparametric approach for estimating variances of parameter estimates. Consider bootstrap.bf. The relevant commands from the batch file are (note that some lines creating output have been deleted for clarity):
LikelihoodFunction theLikFun = (myFilter, myTree, obsFreqs);
Optimize (paramValues, theLikFun);
fprintf  (stdout, theLikFun);

reps = 10;
Tree bsTree = (a,b,og);

for (simCounter = 1; simCounter<=reps; simCounter = simCounter+1)
{
        DataSetFilter simFilter = Bootstrap(myFilter,1);
        HarvestFrequencies (simFreqs, simFilter, 1, 1, 1);
        LikelihoodFunction simLik = (simFilter, bsTree, simFreqs);
        Optimize (simParamValues, simLik);
}

The first section of code is simply the completion of a typical data analysis, storing and printing results from the analysis of data in myFilter. We then create a variable containing the desired number of bootstrap replicates and a copy of the structure myTree for use in the bootstrap replicates. (The latter is not necessary, but because the original structure will often be reused after bootstrap replicates are generated, it is a good programming habit to develop.)

The for loop is the meat of the batch file. For each of the reps replicates, we generate a new DataSetFilter named simFilter. We do this by creating a bootstrap replicate from the existing DataSetFilter named myFilter, which was created in the normal fashion. simFilter will contain the same number of columns as myFilter. Once the new filter has been created, we use it in an appropriate LikelihoodFunction command and find MLEs of the parameters. Notice in the complete batch file (not shown in the code above) how we use the matrix variable BSRes to tabulate and report the average of all bootstrap replicates. More complex analyses can be programmed with relative ease, or the bootstrap replicates can be saved and imported into a spreadsheet for statistical analyses.

The Permute function, with syntax identical to Bootstrap, exists for applications where the columns in the existing DataSetFilter must appear exactly once in each of the simulated datasets. This feature may be useful for comparisons between the three codon positions or for studies investigating spatial correlations or spatial heterogeneity.


next up previous
Next: The Parametric Bootstrap: parboot.bf Up: Simulation Tools Previous: Simulation Tools
Spencer Muse
2000-05-31
 
Sergei L. Kosakovsky Pond and Spencer V. Muse, 1997-2002