qap_run: Quadratic Assignment Procedure ('qap_run').

View source: R/qap_run.R

qap_runR Documentation

Quadratic Assignment Procedure (qap_run).

Description

The qap_run function is a wrapper around sna's Quadratic Assignment Procedure models sna::netlm and sna::netlogit. It expects a networks objects containing dependent and independent variables of interest. It is required to use the output from qap_setup.

Usage

qap_run(
  net,
  dependent = NULL,
  variables,
  directed = FALSE,
  family = "linear",
  reps = 500
)

Arguments

net

An igraph or network object.

dependent

A string naming the dependent variable of interest. By default, the probability of a tie. Can also be the output of qap_setup using prefixes "same_", "diff_" or "abs_diff_".

variables

A vector of strings naming the independent variables of interest. Must be the output of qap_setup using prefixes "same_", "diff_" and "abs_diff_", or suffixes "_ego" and "_alter".

directed

A logical statement identifying if the network should be treated as directed. Defaults to FALSE.

family

A string identifying the functional form. Options are "linear" and "binomial". Defauts to "linear".

reps

A numeric value indicating the number of draws. Defaults to 500.

Value

'qap_run' returns a list of elements that include:

- covs_df, a data frame containing term labels, estimates, standard errors and p-values

- mods_df, a data frame containing model-level information including the number of observations, AIC and BIC statistics.

Examples


flor <- netwrite(nodelist = florentine_nodes,
                 node_id = "id",
                 i_elements = florentine_edges$source,
                 j_elements = florentine_edges$target,
                 type = florentine_edges$type,
                 directed = FALSE,
                 net_name = "florentine_graph")

flor_setup <- qap_setup(flor$florentine_graph,
                        variables = c("total_degree"),
                        methods = c("difference"))

flor_qap <- qap_run(flor_setup$graph,
                    variables = c("diff_total_degree"))

# Inspect results
flor_qap$covs_df

ideanet documentation built on April 3, 2025, 11:55 p.m.