Summary In the analysis of animal social networks, a common challenge has been distinguishing affiliations – active preferences of pairs of individuals to interact or associate with one another – from other, structural, causes of association or interaction. Such structural factors can include patterns of use of the habitat in time and space, gregariousness and differential association rates among age/sex classes. In an approach with similarities to the multiple regression quadratic assignment procedures test, we suggest calculating generalized affiliation indices as the residuals from a regression of the measures of association or interaction on structural predictor variables, such as gregariousness and spatiotemporal overlap. If the original data are association indices or counts of interactions, then generalized linear models with binomial or Poisson error structures, respectively, can be used in place of linear regression. Anscombe or deviance residuals can be used to assess the significance of particular affiliation indices. Generalized affiliation indices can be used as the weights of links in a social network representation. They can then be portrayed in network diagrams or cluster diagrams and used to calculate network statistics, to delineate communities by maximizing modularity and to test for overall affiliation using data‐stream permutation tests. We evaluate the effectiveness of such generalized affiliation indices using simulated and real association data, finding that the method removes much of the effect of structural variables on association patterns, revealing real affiliations. While the approach is very promising, it is limited by the extent to which the input predictor variables represent important structural factors.