Skip to contents

Create STbayes data object from user supplied data to be used for generating and fitting models. This function is basically only used when fitting models of complex transmission to high-resolution data. Rather than pre-process high res data, this will just create a massive data-list to be sent to Stan. Models created with this function will take much longer to run.

Usage

import_user_STb2(
  event_data,
  networks,
  network_type = c("undirected", "directed"),
  ILV_c = NULL,
  ILV_tv = NULL,
  ILVi = NULL,
  ILVs = NULL,
  ILVm = NULL,
  t_weights = NULL,
  high_res = FALSE
)

Arguments

event_data

dataframe with columns id, trial, time, t_end

networks

Either a dataframe, a bisonr/STRAND fit, a posterior-draw array, or a list of bisonr/STRAND fits or posterior-draw arrays. If dataframe: with columns trial, focal, other, and one or more columns of edge weights named descriptively. Edge weights describe the influence that other has on focal. Optionally an integer time column can be provided for dynamic network analysis, although networks must be provided for each inter-event interval. If array: user-supplied posterior draws must be on the logit scale. Arrays must have named dimensions of either [draw, focal_ID, other_ID], [trial, draw, focal_ID, other_ID] or [trial, time, draw, focal_ID, other_ID], depending on the level of detail users have regarding the networks. If trial or time is not provided, the same network is used for all trials and/or times respectively. To create a multi-network NBDA with posterior arrays, provide a list of arrays, one for each network.

network_type

"undirected" or "directed".

ILV_c

optional dataframe with columns id, and any constant individual-level variables. Variables can be binary, categorical or continuous. Categorical variables must be factors.

ILV_tv

optional dataframe with columns trial, id, time and any time-varying variables. Variable values should summarize the variable for each inter-acquisition period.

ILVi

Optional character vector of column names from ILV metadata to be considered when estimating intrinsic rate. If not specified, all ILV are applied to both.

ILVs

Optional character vector of column names from ILV metadata to be considered when estimating social transmission rate. If not specified, all ILV are applied to both.

ILVm

Optional character vector of column names from ILV metadata to be considered in a multiplicative model.

t_weights

Optional dataframe with columns trial, id, time and t_weight. Transmission rates represent rates of production/relevant cues per inter-event period.

high_res

Boolean indicating whether or not user is providing networks and transmission weights per period duration=1

Value

A list object containing properly formatted data to run social transmission models.