| motif_census | R Documentation |
Calculates the total motif counts for a given model, in terms of the number of times each motif appears in the data.
motif_census(m, locs)
m |
An object of class DEFM. |
locs |
Idx (starting from zero) with the variables that will be included in the census. |
A matrix of class defm_motif_census with the motif counts.
Vega Yon, G. G., Pugh, M. J., & Valente, T. W. (2022). Discrete Exponential-Family Models for Multivariate Binary Outcomes (arXiv:2211.00627). arXiv. https://arxiv.org/abs/2211.00627
# Loading Valente's SNS data
data(valentesnsList)
mymodel <- new_defm(
id = valentesnsList$id,
Y = valentesnsList$Y,
X = valentesnsList$X,
order = 1
)
# Adding the intercept terms and a motif from tobacco to mj
term_defm_logit_intercept(mymodel)
term_defm_transition_formula(mymodel, "{y1, 0y2} > {y1, y2}")
# Initialize the model
init_defm(mymodel)
# Motif counts featuring only the first two variables
motif_census(mymodel, locs = 0:1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.