glmqap | R Documentation |
This function fits a generalised linear model of the given family and assesses the significance of the estimated coefficients using a quadratic assignment procedure. Multiple types of permutation are provided, with the default being the double semi-partialling method.
glmqap( formula, family = "gaussian", weights = NULL, offset = NULL, nperm = 1000, permutation = "DSP" )
formula |
A |
family |
Either a |
weights |
Square matrix of weights used for fitting, see Details. |
offset |
Square matrix of offsets for fitting, see Details. |
nperm |
Numeric, number of permutations to perform. |
permutation |
Character specifying what form of permutation to carry out. One of |
NOTE: This function is soft-deprecated as of version 0.2. It has become increasingly clear that these permutation procedures are less informative than other analytical methods, particularly methods using multi-membership random effects. Unless you have a very large dataset that makes fitting a Bayesian model impractical, it is strongly recommended to use dyadic_brm instead.
The multiple regression quadratic assignment procedure (MRQAP) is the canonical method for dyadic regression in social networks. However, this method comes with two major assumptions: The residuals of the response are approximately normal (although the DSP method is fairly robust to violations of this assumption), and the social relationships of all dyads are measured with the same precision. These assumptions are almost never met in animal social network analyses. Replacing the ordinary least-squares fit used in MRQAP with a GLM allows us to address both of these issues in a theoretically sound way, by specifying error families, offsets, and weights.
The weights
argument allows for specification of sampling weights per dyad. For binomial models (appropriate for association indices), these weights should be the dyadic denominator of the association index.
The offset
argument gives a matrix with a known coefficient of 1 in the model. This will primarily be useful for interaction rates. Here, we can use a count model without an upper bound (by setting family
to be one of "poisson"
, "quasipoisson"
, or "negbin"
), and include the logarithm of dyadic sampling effort as an offset. This means we're using sampling effort as an exposure term, and therefore modelling interaction rates rather than just counts.
In most cases, the model is fit using glm. However, if family = "betar"
, the betareg function from the betareg
package is used, and if family = "negbin"
, the glm.nb function from the MASS
package is used.
Beta models will be most useful for association index type data without an integer numerator/denominator (such as measurements of portion time together from biologgers/video). Dyadic sampling effort can still be specified as the weights, but take care.
In betareg()
, weights are treated as sampling, rather than proportional, weights. This means that the function assumes your true sample size is sum(weights)
. While this won't effect your estimate or significance (because we use permutations), it will give
pretty strange results for the standard errors. A solution is to transform your weights such that sum(weights) = length(weights)
.
The function allows multiple types of permutation. The "DSP"
method is the most robust for testing multiple predictors, and is based on the method proposed by Dekker et al. (2007). This explicitly tests the effect of each covariate, controlling for the effect of others and the relationship between variables.
The "Y"
permutation method permutes the response matrix, and tests the null hypothesis that the response is unrelated to any of the predictors.
The "X"
method permutes each predictor matrix, testing the null hypothesis of no relationship, but importantly does not control for any covariance among predictors.
Note that if your formula contains only a single predictor, the function will default to permutation = "Y"
.
An object of class glmqap
, containing a summary of the fitted model. The coefficients table now contains p-values from the randomizations. In addition to all information normally in the respective model summary objects, the object contains an element called permuted_z
, which is a matrix containing the permuted value of each pivotal statistic for all permutations.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.