| srm_run | R Documentation |
A wrapper function that fits the Social Relations Model (SRM) on a
directed dyadic dataset using restricted maximum likelihood via
lme. The function creates the necessary actor and
partner dummy variables, constructs the SRM covariance structure using
pdSRM, and returns both the raw lme output and a
formatted variance decomposition table.
srm_run(dv, group_id, act_id, part_id, fe_vars = NULL, data)
dv |
string; name of the directed dyadic criterion (outcome) variable |
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 |
fe_vars |
character vector of fixed-effect predictor variable names,
or |
data |
a |
a named list with two elements:
lme.outputthe full lme model object
srm.outputa data.frame from srm_var_pct
giving variances, percentages, and reciprocity correlations
Knight, A. P., & Humphrey, S. E. (2019). Dyadic data analysis. In S. E. Humphrey & J. M. LeBreton (Eds.), The Handbook for Multilevel Theory, Measurement, and Analysis (pp. 423–447). American Psychological Association. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1037/0000115-019")}
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")}
o <- srm_run(
dv = "liking",
group_id = "groupId",
act_id = "actId",
part_id = "partId",
fe_vars = c("actEx", "partEx", "contact"),
data = sampleDyadData[sampleDyadData$timeId == 1, ]
)
o$srm.output
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.