This function generates a matrix of traits based on the given number of patches, species, the number of "additional" traits with a given correlation coefficient. The first trait is always uniform between 1 and the number of patches provided. Then the other traits are generated correlated to this first one. In the end all the traits are scaled between 1 and the number of patches.

generate_cor_traits(
  number_patches,
  number_species,
  number_other = 9,
  cor_coef = 0.7,
  min_value = 1
)

Arguments

number_patches

a numeric value giving the total number of patches

number_species

a numeric value giving the total number of species to simulate (number of rows in the trait tables)

number_other

a numeric value giving the number of additional traits to generate in addition to the trait correlated to the number of patches

cor_coef

a numeric value giving the correlation coefficient between the first trait and the other ones

min_value

a minimum trait value

Value

a matrix of traits with species in rows and traits in columns

Examples

traits <- generate_cor_traits(25, 100, 3, 0.3)