get_design_matrix_pglmm: 'get_design_matrix' gets design matrix for gaussian,...

Description Usage Arguments Value

Description

get_design_matrix gets design matrix for gaussian, binomial, and poisson models

Usage

1

Arguments

formula

A two-sided linear formula object describing the mixed effects of the model.

To specify that a random term should have phylogenetic covariance matrix along with non-phylogenetic one, add __ (two underscores) at the end of the group variable; e.g., + (1 | sp__) will construct two random terms, one with phylogenetic covariance matrix and another with non-phylogenetic (identity) matrix. In contrast, __ in the nested terms (below) will only create a phylogenetic covariance matrix. Nested random terms have the general form (1|sp__@site__) which represents phylogenetically related species nested within correlated sites. This form can be used for bipartite questions. For example, species could be phylogenetically related pollinators and sites could be phylogenetically related plants, leading to the random effect (1|insects__@plants__). If more than one phylogeny is used, remember to add all to the argument cov_ranef = list(insects = insect_phylo, plants = plant_phylo). Phylogenetic correlations can be dropped by removing the __ underscores. Thus, the form (1|sp@site__) excludes the phylogenetic correlations among species, while the form (1|sp__@site) excludes the correlations among sites.

Note that correlated random terms are not allowed. For example, (x|g) will be the same as (0 + x|g) in the lme4::lmer syntax. However, (x1 + x2|g) won't work, so instead use (x1|g) + (x2|g).

data

A data.frame containing the variables named in formula.

random.effects

Optional pre-build list of random effects. If NULL (the default), the function prep_dat_pglmm will prepare the random effects for you from the information in formula, data, and cov_ranef. random.effect allows a list of pre-generated random effects terms to increase flexibility; for example, this makes it possible to construct models with both phylogenetic correlation and spatio-temporal autocorrelation. In preparing random.effect, make sure that the orders of rows and columns of covariance matrices in the list are the same as their corresponding group variables in the data. Also, this should be a list of lists, e.g. random.effects = list(re1 = list(matrix_a), re2 = list(1, sp = sp, covar = Vsp)).

na.action

What to do with NAs?

Value

A list of design matrices.


phyr documentation built on Jan. 13, 2021, 5:40 p.m.