iqv: Agresti's Index of Qualitative Variation ('iqv')

View source: R/iqv.R

iqvR Documentation

Agresti's Index of Qualitative Variation (iqv)

Description

A normalized value of the h-index for measuring the diversity of an ego's network for categorical attributes (Perry et al. 2018)

Usage

iqv(ego_id, measure, prefix = NULL, suffix = NULL)

Arguments

ego_id

A vector of ego identifiers located in an alter dataframe. If using data objects created by ego_netwrite, this should be the data frame entitled alters.

measure

A vector of alter attributes for a given categorical measure.

prefix

A character value indicating the desired prefix for the calculated homophily measure.

suffix

A character value indicating the desired suffix for the calculated homophily measure.

Value

iqv returns a dataframe of vectors that include the ego identifier and iqv value of diversity for the desired categorical attribute.

Examples


# Run `ego_netwrite`
ngq_nw <- ego_netwrite(egos = ngq_egos,
                      ego_id = ngq_egos$ego_id,

                      alters = ngq_alters,
                      alter_id = ngq_alters$alter_id,
                      alter_ego = ngq_alters$ego_id,

                      max_alters = 10,
                      alter_alter = ngq_aa,
                      aa_ego = ngq_aa$ego_id,
                      i_elements = ngq_aa$alter1,
                      j_elements = ngq_aa$alter2,
                      directed = FALSE)


# Get IQV for sex
sex_iqv <- iqv(ego_id = ngq_nw$alters$ego_id,
              measure = ngq_nw$alters$sex,
              prefix = "sex")

sex_iqv

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