make_strand_data: A function to create a STRAND data object

View source: R/make_strand_data.R

make_strand_dataR Documentation

A function to create a STRAND data object

Description

This function organizes network data and covariates into a form that can be used by STRAND for model fitting. All STRAND model fitting functions require their data to be supplied in the format exported here.

Usage

make_strand_data(
  outcome = NULL,
  self_report = NULL,
  outcome_mode = "bernoulli",
  ground_truth = NULL,
  block_covariates = NULL,
  individual_covariates = NULL,
  dyadic_covariates = NULL,
  exposure = NULL,
  m_e_data = NULL,
  mask = NULL,
  multiplex = FALSE
)

Arguments

outcome

A list of primary network data (e.g., self reports). This argument is just another name for self_report as described below.

self_report

A list of primary network data (e.g., self reports). Each entry in the list must be an adjacency matrix. This will be a list of length 1 for single-sampled networks and a list of length 2 for double-sampled networks. Data is presumed to be organized such that self_report[[1]][i,j] represents i's reports of transfers from i to j, and self_report[[2]][i,j] represents i's reports of transfers from j to i. Data should be binary, 0 or 1, unless an alternative outcome_mode is provided. If outcome_mode="poisson", then data can be integer values. If an exposure variable is provided, self_report can take integer values and outcome_mode="binomial" can be set.

outcome_mode

Can be either "bernoulli", "binomial", or "poisson", based on the kind of network data being modeled.

ground_truth

A list of secondary network data about equivalent latent relationships (i.e., from focal observations). Each entry in the list must be an adjacency matrix. Data is presumed to be organized such that ground_truth[[t]][i,j] represents observed transfers from i to j at time-point t.

block_covariates

A vector of group IDs (e.g., ethnicity, class, religion, etc.) corresponding to the individuals in the 'self_report' network(s). This should be provided as a factor.

individual_covariates

An N_id by N_parameters dataframe of all individual-level covariates that are to be included in the model.

dyadic_covariates

A list of N_id by N_id by N_dyadic_parameters matrices.

exposure

A list of matrices matched to the self_report matrices. If self_report is a count data set with binomial outcomes, then this variable holds the sample size information.

m_e_data

A list of integer vectors: list(sampled=sampled, sampled_exposure=sampled_exposure, detected=detected, detected_exposure=detected_exposure), to be used in measurement error models.

mask

A list of matrices matched to the self_report matrices. If mask[i,j,m]==0, then ties between i and j in layer m are detectable. If mask[i,j,m]==1, then i to j ties in layer m are censored (e.g., if i and j were monkeys kept in different enclosures).

multiplex

If TRUE, then all layers in outcome are modeled jointly.

Value

A list of data formatted for use by STRAND models.

Examples

## Not run: 
model_dat = make_strand_data(self_report=LoanData)

## End(Not run)


ctross/STRAND documentation built on Nov. 14, 2024, 11:50 p.m.