simulate_data | R Documentation |
simulate_data
simulates data according to the data-generating process
defined by the model.
simulate_data(
n_users = 200,
n_domains = 500,
n_groups = 2,
group_prob = c(0.4, 0.6),
user_variance = FALSE,
params = list(alpha_mu = 2, alpha_sigma = 0.5, gamma_sigma = 0.75, theta_mu = c(-0.75,
0.5), theta_sigma = c(0.25, 0.25), omega_user_shape = 5, omega_user_rate = 5,
omega_domain_shape = 5, omega_domain_rate = 5)
)
n_users |
int, number of users in the data |
n_domains |
int, number of domains that users can share |
n_groups |
int, number of groups users can belong to |
group_prob |
numeric vector of length |
user_variance |
logical, whether to fit the model with an additional variance parameter per user (i.e. omega_user) |
params |
list containing complete (or partial) list of parameter values of the model. See Details section for more information. |
Returns a list with elements:
'Y'
: A matrix (n_users x n_domains) of simulated counts of
times each user shared a domain
'group'
: Vector of length n_users
indicating group
membership of each user
'anchors'
: Index position (column in 'shares_data'
)
with the most extreme domains (minimum, maximum on latent scale)
'parameters'
: Simulated parameters:
'alpha'
: Numeric vector of length n_users
,
user-level intercepts
'gamma'
: Numeric vector of length n_domains
,
domain-level intercepts
'theta'
: Numeric vector of length n_users
,
ideology of each user
'zeta'
: Numeric vector of length n_domains
,
ideology of each domain
'omega_domain'
: Numeric vector of length n_domains
,
variance parameter for domain
'omega_user'
: Numeric vector of length n_users
,
variance parameter for each user
The data-generating process is defined as the following:
NegBin(\pi_{img}, \omega_i\omega_m)
\pi_{img} = \alpha_i + \gamma_m - ||\vartheta_i - \zeta_m||^2,
where \alpha_i
denotes a user-level intercept; \gamma_m
, a news
media domain intercept; \vartheta_i
the sharing-ideology of user
i
; zeta_m
the ideology of news media domain m
; and
\omega_i
and \omega_m
, user- and domain-level variance parameters.
Further details regarding can be found in the library's vignette.
simulated_data <- simulate_data()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.