mlpe_rga | R Documentation |
Runs MLPE as detailed by Clarke et al. (2002). This is a general function for flexibly fitting MLPE models using the standard lme4
formula interface
mlpe_rga(formula,
data,
REML = FALSE,
ZZ = NULL,
keep = NULL)
formula |
|
data |
data frame containing vectors of values from the lower half of genetic/resistance distance matrices |
REML |
Logical. If TRUE, mixed effects model will be fit using restricted maximum likelihood. Default = FALSE |
ZZ |
The sparse matrix object for the MLPE model. The function will automatically create this object, but it can be specified directly from the output of CS.prep or gdist.prep (Default = NULL) |
keep |
A vector consisting of 1 (keep) or 0 (drop) for each pairwise observation in |
An AIC value will only be returned if REML = FALSE
. The random effect must be the population vector pop1
generated from the function To.From.ID
.
A generalized MLPE model can be fit if an appropriate family
. It is not possible to use REML when fitting a generalized model.
A lmer object from the fitted model
Bill Peterman <Peterman.73@osu.edu>
Clarke, R. T., P. Rothery, and A. F. Raybould. 2002. Confidence limits for regression relationships between distance matrices: Estimating gene flow with distance. Journal of Agricultural, Biological, and Environmental Statistics 7:361-372.
# Create square 'distance' matrices
y <- matrix(rnorm(25), 5)
y.pois <- matrix(rpois(25, 5), 5)
x <- matrix(rnorm(25), 5)
# Create to-from object (5 populations sampled)
id <- To.From.ID(5)
# Create data frame
df <- data.frame(y = lower(y),
y.pois = lower(y.pois),
x = lower(x),
pop = id$pop1)
# Fit MLPE model
out <- mlpe_rga(formula = y ~ x + (1 | pop),
REML = TRUE,
data = df)
# Fit generalized MLPE model
out.pois <- mlpe_rga(formula = y.pois ~ x + (1 | pop),
family = poisson,
data = df)
# Fit model with only select pairs
keep <- c(1,1,1,1,1,1,0,1,1,0)
out.select <- mlpe_rga(formula = y ~ x + (1 | pop),
data = df,
keep = keep)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.