simulatePhyloPoissonLogNormal: Simulate Tree Structured Counts

View source: R/simulatePhyloPoissonLogNormal.R

simulatePhyloPoissonLogNormalR Documentation

Simulate Tree Structured Counts

Description

Simulate a tree structured matrix of counts according to a Poisson-lognormal model, with the log parameter of the poisson following a Brownian Motion (BM) on the tree with noise.

Usage

simulatePhyloPoissonLogNormal(
  tree,
  log_means,
  log_variance_phylo,
  log_variance_sample,
  model.process = "BM",
  selection.strength = 0
)

Arguments

tree

A phylogenetic tree with n tips.

log_means

a matrix with the number of genes p rows and the number of species n columns. Column names should match the tree taxa names.

log_variance_phylo

a vector of length p of phylogenetic variances for the BM in the log space for each gene.

log_variance_sample

a matrix of size p x n of environmental variances for individual variations in the log space, for each gene and species. Column names should match the tree taxa names.

Details

For each gene, the log-lambda parameter evolves like a BM on the tree, with an extra independent variance noise that can depend on the species. Each gene has its own tree variance for the BM. Each gene and each species has its own mean. The counts for each gene and each species are then obtained as a Poisson draw with a different lambda parameter, as generated by the BM.

Value

A list, with:

log_lambda

the p x n matrix of log-lambda simulated by the BM on the tree.

counts

the p x n matrix of counts with corresponding Poisson draws.


csoneson/compcodeR documentation built on Oct. 25, 2023, 1:28 a.m.