To.From.ID | R Documentation |
Convenience function to make to-from object needed for specifying MLPE random effects
To.From.ID(sampled_pops,
pop_n = NULL,
spLoc = NULL,
nb = NULL,
...)
sampled_pops |
Provide an integer value representing the number of individuals or populations that were sampled |
pop_n |
Provide a vector of length equal to 'sampled_pops', indicating the number of individuals sampled at each population. Only needed if going from a population- to an individual-based analysis |
spLoc |
|
nb |
Distance between points that should be considered as part of the same group or neighborhood. If |
... |
Additional arguments. Currently only 'dist' argument is accepted. |
This function creates an object indicating the population pairs that distance values were calculated between. Note: Distance values must be taken from the lower half of a distance matrix. You can use lower
to obtain these values. When specifying a MLPE model using mlpe_rga
, pop1
from To.From.ID
must be added to the data frame containing model data, and must be specified as the random effect.
By providing spLoc
, you can add an additional random effect to account for spatial proximity of sample locations. You must also specify nb
, which indicates the maximum distance (in units of your spLoc
object) that locations are considered to be part of the same neighborhood.
A data frame with two columns
Bill Peterman <Peterman.73@osu.edu>
## Standard use
To.From.ID(sampled_pops = 4)
## If going from population to individual-level
To.From.ID(sampled_pops = 4,
pop_n = c(1,2,3,1))
## A vector of pairwise distances can also be expanded
To.From.ID(sampled_pops = 4,
pop_n = c(1,2,3,1),
dist = runif(6))
## Spatial location incorporated
spLoc <- SpatialPoints(cbind(c(1,2,9,10),
c(1,2,9,10)))
To.From.ID(sampled_pops = 4,
spLoc = spLoc,
nb = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.