# Bayesian Model Averaging

### Description

Bayesian Model Averaging

Perform Bayesian Model Averaging. We concentrate on the chain with temperature=1 , i.e the untempered posterior, to study the distribution over the model choices and perform model averaging. We consider as present the species that have a posterior probability greater than 0.9. We then fit the mixture model with these species in order to obtain relative abundances and read classification probabilities. A tab seperated file that has a species summary is produced, as well as log-likelihood traceplots and cumulative histogram plots.

bayes.model.aver.explicit is the same function as bayes.model.aver with a more involved syntax.

### Usage

1 2 3 4 | ```
bayes.model.aver(step2, step3, taxon.name.map = NULL, poster.prob.thr = 0.9)
bayes.model.aver.explicit(result, pij.sparse.mat, read.weights, outDir,
gen.prob.unknown, taxon.name.map = NULL, poster.prob.thr = 0.9)
``` |

### Arguments

`step3` |
list. The output from parallel.temper(), i.e the third step of the pipeline. Alternatively, it can be a character string containing the path name of the ".RData" file where step3 list was saved. |

`step2` |
list. The output from reduce.space(), i.e the second step of the pipeline. Alternatively, it can be a character string containing the path name of the ".RData" file where step2 list was saved. |

`taxon.name.map` |
The 'names.dmp' taxonomy names file, mapping each taxon identifier to the corresponding scientific name. It can be downloaded from ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz |

`poster.prob.thr` |
Posterior probability of presence of species threshold for reporting in the species summary. |

`result` |
The list produced by parallel.temper() (or paraller.temper.nucl()) . It holds a detailed record for each chain, what moves were proposed, which were accepted and which were rejected as well the log-likelihood through the iterations. |

`pij.sparse.mat` |
see ?reduce.space |

`read.weights` |
see ?reduce.space |

`gen.prob.unknown` |
see ?reduce.space |

`outDir` |
see ?reduce.space |

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
## See vignette for more details
## Not run:
# Either load the object created by previous steps
data(step2) ## example output of step2, i.e reduce.space()
data(step3) ## example ouput of step3, i.e parallel.temper()
step4<-bayes.model.aver(step2=step2, step3=step3, taxon.name.map="pathtoFile/taxon.file")
# or alternatively point to the location of the step2.RData and step3.RData objects
step4<-bayes.model.aver(step2="pathtoFile/step2.RData", step3="pathtoFile/step3.RData",
taxon.name.map="pathtoFile/taxon.file")
## End(Not run)
``` |