covFX: Generate estimated monadic covariate effects for estimated...

View source: R/covFX.R

covFXR Documentation

Generate estimated monadic covariate effects for estimated mmsbm model

Description

The function estimates the effect of a shift in monadic covariate values on the probability of edge formation in the network.

Usage

covFX(fm, cov, shift, max.val = FALSE)

Arguments

fm

An object of class mmsbm, a result of a call to mmsbm.

cov

Character string identifying the monadic covariate to be shifted.

shift

Numeric value specifying the desired increase or decrease in the monadic covariate. The monadic predictor will be shifted by this value for all nodes and time periods.

max.val

An optional numeric value specifying the maximum possible value for the monadic covariate.

Value

List with named components:

Overall Avg. Effect

Overall average effect of the covariate shift on the predicted probability of edge formation.

Avg. Effect by Time

Vector of average effects of the covariate shift on the predicted probability of edge formation for each time period.

Avg. Effect by Node

Vector of average effects of the covariate shift on the predicted probability of edge formation for each node.

Avg. Effect by Dyad

Vector of average effects of the covariate shift on the predicted probability of edge formation for each node dyad.

Avg. Effect Dyad-Time

Vector of estimated effects of the covariate shift on the predicted probability of edge formation for each node dyad-time unit.

Author(s)

Santiago Olivella (olivella@unc.edu), Adeline Lo (aylo@wisc.edu), Tyler Pratt (tyler.pratt@yale.edu), Kosuke Imai (imai@harvard.edu)

Examples

library(NetMix)
## Load datasets
data("lazega_dyadic")
data("lazega_monadic")
## Estimate model with 2 groups
lazega_mmsbm <- mmsbm(SocializeWith ~ Coworkers,
                      ~  Age,
                      senderID = "Lawyer1",
                      receiverID = "Lawyer2",
                      nodeID = "Lawyer",
                      data.dyad = lazega_dyadic,
                      data.monad = lazega_monadic,
                      n.blocks = 2,
                      mmsbm.control = list(seed = 123, 
                                           conv_tol = 1e-2, 
                                           hessian = FALSE))

## Compute effect of decreasing every lawyers' age by 10 years
fx_list <- covFX(lazega_mmsbm, cov = "Age", shift = -10)
fx_list[["Overall Avg. Effect of Age"]]


NetMix documentation built on Nov. 16, 2022, 5:15 p.m.