View source: R/create_dummies.R
| create_dummies | R Documentation |
Generates the actor and partner dummy variables required to fit the Social Relations Model (SRM) using multilevel modeling, following the approach of Snijders and Kenny (1999). The function produces N actor dummies and N partner dummies, where N is the maximum group size in the dataset.
create_dummies(
group_id,
act_id,
part_id,
data,
include_self = FALSE,
merge_original = FALSE
)
group_id |
string; name of the group identifier variable |
act_id |
string; name of the actor identifier variable |
part_id |
string; name of the partner identifier variable |
data |
a |
include_self |
logical; if |
merge_original |
logical; if |
a data.frame containing:
pdSRM_act_idinteger internal actor identifier
pdSRM_part_idinteger internal partner identifier
pdSRM_act_numinteger actor slot number within group
pdSRM_part_numinteger partner slot number within group
pdSRM_dyad_idinteger undirected dyad identifier
a1, a2, ...actor dummy variables
p1, p2, ...partner dummy variables
If merge_original = TRUE, all original variables are appended.
Snijders, T. A. B., & Kenny, D. A. (1999). The social relations model for family data: A multilevel approach. Personal Relationships, 6, 471–486. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/j.1475-6811.1999.tb00204.x")}
d_out <- create_dummies(
group_id = "groupId",
act_id = "actId",
part_id = "partId",
data = sampleDyadData
)
head(d_out)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.