View source: R/srm_pseudo_rsq.R
| srm_pseudo_rsq | R Documentation |
Computes pseudo R-squared values for each SRM variance component by
comparing a null model (intercept only) with a predictor model (with
fixed effects). The pseudo R-squared for each component is
(null - predicted) / null, reflecting the proportion of each
variance component explained by the fixed effects.
srm_pseudo_rsq(null_model, predict_model)
null_model |
an |
predict_model |
an |
a data.frame with three columns and four rows (Group,
Actor, Partner, Dyad):
nullvariance component from the null model
predictvariance component from the predictor model
pseudoR2pseudo R-squared: (null - predict) / null
d <- create_dummies(
group_id = "groupId", act_id = "actId", part_id = "partId",
data = sampleDyadData[sampleDyadData$timeId == 1, ],
merge_original = TRUE
)
null_mod <- 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
)
pred_mod <- nlme::lme(
liking ~ actEx + partEx + contact,
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_pseudo_rsq(null_model = null_mod, predict_model = pred_mod)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.