View source: R/simulate_diffusion.R
simulate_diffusion | R Documentation |
This function allows users to simulate data using a NBDA model. The user must supply a list of STRAND data objects, a set of parameters, and a series of formulas following standard lm() style syntax.
simulate_diffusion(
long_data,
individual_focal_regression,
social_focal_regression,
social_target_regression,
social_dyad_regression,
individual_focal_parameters,
social_focal_parameters,
social_target_parameters,
social_dyad_parameters,
base_rates,
ces_parameters = list(alpha = 0.95, sigma = 100, eta = 1)
)
long_data |
A list of data objects of class STRAND prepared using the make_strand_data() function. The data objects must include all covariates and trait diffusion data used in the formulas listed below. |
individual_focal_regression |
A formula for the effects of focal predictors on individual learning rate. This should be specified as in lm(), e.g.: ~ Age * Education. |
social_focal_regression |
A formula for the effects of focal predictors on social attention weights. This should be specified as in lm(), e.g.: ~ Age * Education. |
social_target_regression |
A formula for the effects of target predictors on social attention weights. This should be specified as in lm(), e.g.: ~ Age * Education. |
social_dyad_regression |
A formula for the predictors of dyadic relationships on social attention weights. This should be specified as in lm(), e.g.: ~ Kinship + Friendship. |
individual_focal_parameters |
A formula for the effects of focal predictors on individual learning rate. This should be specified as in lm(), e.g.: ~ Age * Education. |
social_focal_parameters |
A formula for the effects of focal predictors on social attention weights. This should be specified as in lm(), e.g.: ~ Age * Education. |
social_target_parameters |
A formula for the effects of target predictors on social attention weights. This should be specified as in lm(), e.g.: ~ Age * Education. |
social_dyad_parameters |
A formula for the predictors of dyadic relationships on social attention weights. This should be specified as in lm(), e.g.: ~ Kinship + Friendship. |
base_rates |
The intercept parameters for the individual and then social learing rates on logg-odds scale. |
ces_parameters |
A named list: alpha is the share of social influence owing to i to j ties (which implies 1-alpha is the share due to j to i ties), sigma is the elastisity of substitution, eta is returns to scale. |
A STRAND model object containing the data used, and the Stan results.
## Not run:
fit = fit_NBDA_model(long_data=model_dat,
individual_focal_regression = ~ Age * NoFood,
social_block_regression = ~ Ethnicity,
social_focal_regression = ~ Age * NoFood,
social_target_regression = ~ Age * NoFood,
social_dyad_regression = ~ Relatedness + Friends * SameSex,
mode="mcmc",
stan_mcmc_parameters = list(seed = 1, chains = 1,
parallel_chains = 1, refresh = 1,
iter_warmup = 100, iter_sampling = 100,
max_treedepth = NULL, adapt_delta = NULL)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.