gai | R Documentation |
Caluclates a social network based on generalised affiliation indices (GAI). When non-social factors influence the observed interactions or associations, using GAIs can help to remove the effect of these factors, revealing underlying social affinities. This is done by fitting a generalised linear model, with the observed network as a response and non-social confounds as predictors, and using the residuals as a measure of affiliation.
gai( formula, family = "gaussian", weights = NULL, offset = NULL, type = c("deviance", "pearson", "response") )
formula |
A glm style formula giving the response and predictor matrices. |
family |
Error family for fitting, either a |
weights |
Weights used for fitting, see Details. |
offset |
Offset used in fitting, see Details. |
type |
Type of residuals to calculate |
For association data, family = "binomial"
is the most appropriate. In this case, the observed association indices should be the response matrix, and the dyadic denominators should be passed to the weights
argument.
For interaction rates, one of "poisson"
, "quasipoisson"
, or "negbin"
should be passed to family
, with log(sampling effort) passed as an offset.
For completeness, beta regression is also included, using betareg::betareg()
.
Generally, its a good idea to test whether the predictors are important prior to calculating GAIs. This can be done using GLMQAP.
A square matrix containing the generalised affiliation indices.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.