View source: R/simulateDataSet.R
simulateDataSet | R Documentation |
Returns a list with a data frame containing the simulated traits and the variance-covariance matrix used. The number of traits simulated doubles the number of rows in the supplied variance-covariance matrix, which needs to be symmetric (i.e., same number of rows and columns). This is because two sets of traits are simulated under the same variance covariance. In the first set of traits, their variances and covariances are phylogenetically conserved, while the second set of traits variances and covariances are phylogenetically independent.
simulateDataSet(
phylogeny = NULL,
number_observations = 100,
trait_names = c("G1_trait1", "G1_trait2", "G1_env", "G2_trait1", "G2_trait2", "G2_env"),
vcv_matrix = matrix(c(1, 0.9, 0.8, 0, 0.1, 0.2, 0.9, 1, 0.8, 0, 0.1, 0.2, 0.8, 0.8, 1,
0, 0.1, 0.2, 0, 0, 0, 1, 0.9, 0.8, 0.1, 0.1, 0.1, 0.9, 1, 0.8, 0.2, 0.2, 0.2, 0.8,
0.8, 1), ncol = 6)
)
phylogeny |
(phylo). Phylogeny under which simulate the phylogenetically correlated traits (i.e., phylogenetically conserved traits). If not specified, the function generates a phylogeny using the function simulate_bm_model from the castor R package. When not specified, the number of observations need to be specified in the number_observations argument. |
number_observations |
(integer). Number of observations to simulate if phylogeny is not provided. When the phylogeny is provided, the number of terminal taxa of the phylogeny is used, and then, this argument is ignored. |
trait_names |
(character). Names of the traits to simulate following the variance covariance order (i.e., first name correspond to the first row and column). |
vcv_matrix |
(matrix). Variance covariance matrix setting the covariance among traits. The number of rows and colums needs to match the lenght as trait_names. |
A list containing a data frame with phylogenetically and non-phylogenetically correlated traits, the variance-covariance matrix and the phylogeny used.
## Not run:
# Simulate phylogenetically correlated and phylogenetically independent traits using default parameters
simulated_traits.data <- simulateDataSet()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.