simulate_microbiome_counts {BRACoD.R} | R Documentation |

## Simulate microbiome counts

### Description

Each bacteria's absolute abundance is simulated from a lognormal distribution. Then, convert each sample to relative abundance, and simulate sequencing counts using a multinomial distribution, based on the desired number of reads and the simulated relative abundances. This also simulates an environmental variable that is produced by some of the bacteria.

### Usage

```
simulate_microbiome_counts(
df,
n_contributors = 20,
coeff_contributor = 0,
min_ab_contributor = -9,
sd_Y = 1,
n_reads = 1e+05,
var_contributor = 5,
use_uniform = TRUE,
n_samples_use = NULL,
corr_value = NULL,
return_absolute = FALSE,
seed = NULL
)
```

### Arguments

`df` |
A dataframe of OTU counts that is a model for data simulation. Samples are rows and bacteria are columns. |

`n_contributors` |
the number of bacteria that are to contribute to your environmental variable. |

`coeff_contributor` |
the average of the distribution used to simulate the contribution coefficient. |

`min_ab_contributor` |
The minimum log relative abundance, averaged across samples, to include a bacteria |

`sd_Y` |
the standard deviation of the simulated environmental variable |

`n_reads` |
the number of reads to be simulated per sample |

`var_contributor` |
If you use a uniform distribution, this is the range of the distribution, with a normal distribution it is the variance used to simulate the contribution coefficient. |

`use_uniform` |
use a uniform distribution to simulate the contribution coefficient. Alternative is the normal distribution. |

`n_samples_use` |
number of microbiome samples to simulate. If NULL, uses the same number of samples as in your dataframe |

`corr_value` |
the bacteria-bacteria correlation value you want to include in the simulation |

`return_absolute` |
returns the abosulte abundance values instead of the simulated microbiome counts |

`seed` |
random seed for reproducibility |

### Value

a list containing 1) the simulated count data 2) the simulated environmental variable and 3) the simulated contribution coefficients

*BRACoD.R*version 0.0.2.0 Index]