Description Usage Arguments Details Value Author(s) See Also Examples

Simulate a continuous morphological alignment using `rTraitCont`

and later allowing to account for population noise and correlation among characters.

1 | ```
sim.morpho(tree, n, c = 0, R, ...)
``` |

`tree` |
Phylo, object with a phylogenetic tree
(see |

`n` |
Numeric, number of morphological traits to be simulated. |

`c` |
(Optional) numeric, vector with variances for the speccies within a population to add as population noise to the simulated morphological traits (see details). |

`R` |
(Optional) matrix, correlation matrix (see details). |

`...` |
Further arguments passed to |

The function `rTraitCont`

simulates continuous traits and
can take different parameters to adjust the simulation
(e.g. the model, the rate drift, etc.).
These parameters are the ones the user can pass to the argument `...`

in
`sim.morpho`

.
The default values that `sim.morpho`

uses are
`model = "BM"`

, `sigma = 1`

, `ancestor = F`

,
and `root.value = 0`

. For this kind of simulation,
`sim.morpho`

allows only `ancestor = F`

, so please
do not change this parameter.
In the `rTraitCont`

package, the parameter
`model`

can be `model = BM`

, `model = OU`

, or
a function `model = FUN`

provided by the user. Currently,
`sim.morpho`

supports only the first two.

The parameter `c`

contains the population noise, which is used to simulate
the noise matrix. Each parameter follows a normal distribution, `x ~ N(0,c)`

.
If the variances are assumed to be the same for all characters within the species,
then the length of `c`

is 1 and equals to the value of this variance.
If it differs, then a vector of length `n`

has to
be provided specifying the variance for each of the characters.

The simulated noise is later added to the morphological data previously
generated, so we obtain the noisy matrix.
If a correlation matrix, `R`

, is provided, then it is added to the
noisy matrix. See object `sim.R`

for an example of its format and
`data-raw/sim.R`

to understand how it can be generated.
Note that the correlation matrix needs to be of class "matrix"
and symmetric.

`M` |
Matrix with the simulated morphological continuous data accounting for noise and, if provided, for population variance and trait correlation too. |

Sandra Alvarez-Carretero and Mario dos Reis

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ```
# A) Simulation setup: Simulate a morphological alignment
# with n = 100 continuous characters for a phylogeny
# defined in object 'tree', with the default parameters in
# 'sim.morpho' to run 'rTraitCont'.
# Population noise and character correlation are not considered,
# i.e. c = 0 and R not provided.
sim.morpho( tree = sim.tree, n = 100 )
# B) Simulation setup: Simulate a morphological alignment
# with n = 100 continuous characters for a phylogeny
# defined in object 'tree', but with different parameters
# than the default ones in 'sim.morpho' to run
# 'rTraitCont'. Population noise and trait correlation are not
# considered, i.e. c = 0 and R not provided.
sim.morpho( tree = sim.tree, n = 100,
model = "OU", sigma = 0.2, alpha = 2 )
# C) Simulation setup: Simulate a morphological alignment
# with n = 100 continuous characters for a phylogeny
# defined in object 'tree', with the default parameters in
# 'sim.morpho' to run 'rTraitCont'.
# Population noise is low, c = 0.25, but trait correlation is not
# considered, i.e. R not provided.
sim.morpho( tree = sim.tree, n = 100, c = 0.25 )
# D) Simulation setup: Simulate a morphological alignment
# with n = 100 continuous characters for a phylogeny
# defined in object 'tree', with the default parameters in
# 'sim.morpho' to run 'rTraitCont'.
# Population noise is low, c = 0.25, and a correlation
# matrix to simulate trait correlation (rho = 0.50) is provided.
sim.morpho( tree = sim.tree, n = 100, c = 0.25, R = sim.R )
``` |

dosreislab/mcmc3r documentation built on Oct. 20, 2018, 2:41 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.