srm_var_pct: Extract Variance Decomposition from a Fitted SRM

View source: R/srm_var_pct.R

srm_var_pctR Documentation

Extract Variance Decomposition from a Fitted SRM

Description

Extracts and formats the variance components and reciprocity correlations from an lme object fitted with the pdSRM covariance structure. Returns group, actor, partner, and dyadic (relationship) variances as both raw values and percentages of total variance, along with generalized reciprocity (actor-partner correlation) and dyadic reciprocity.

Usage

srm_var_pct(object)

Arguments

object

an lme model object fitted with pdSRM

Value

a data.frame with two columns and six rows:

variances.and.covariances

Group, Actor, Partner, and Dyad variances; Generalized Reciprocity covariance; Dyadic Reciprocity covariance

percents.and.correlations

variance percentages for the four components; Generalized Reciprocity correlation; Dyadic Reciprocity correlation

References

Kenny, D. A., Kashy, D. A., & Cook, W. L. (2006). Dyadic Data Analysis. Guilford Press.

Examples

d <- create_dummies(
  group_id = "groupId", act_id = "actId", part_id = "partId",
  data = sampleDyadData[sampleDyadData$timeId == 1, ],
  merge_original = TRUE
)
o <- nlme::lme(
  liking ~ 1,
  random = list(groupId = nlme::pdBlocked(list(
    nlme::pdIdent(~1),
    pdSRM(~ -1 + a1 + a2 + a3 + a4 + p1 + p2 + p3 + p4)
  ))),
  correlation = nlme::corCompSymm(form = ~1 | groupId / pdSRM_dyad_id),
  data = d,
  na.action = stats::na.omit
)
srm_var_pct(o)

roundRobinR documentation built on Sept. 18, 2026, 1:06 a.m.