compRelSEM manual item weightening

64 views
Skip to first unread message

Hynek Cígler

unread,
Apr 14, 2025, 10:27:50 AM4/14/25
to lavaan
Hi,
I have been struggling very long with a tiny detail in compRelSEM function (and previously in reliability/reliabilityL2 functions), which has big consequences on the easiness of analytical workflow. Therefore, I have a request for a brief but serious improvement.
 
If any CFA model is fitted, reverse-coded items are not any problem; they just have negative factor loadings (and "reversed" intercepts/thresholds, which does not impact reliability estimates). 

However, when estimating reliability using compRelSEM, each item has a "weight" 1 (thus, there is a simple sum of factor loadings and residual variances in the equation). However, if reverse-coded items are present, this approach obviously lead to meaningless results. 

My suggestion is adding a "key" parameter providing manual item weights (default value would be vector of repeated "1"), which could be +1 and -1, or even 0(!) or any other value if reliability of weigted item sum is desired. Then, each row in lambda matrix should be multiplied by this weights, i.e.
lambda <- lambda * keys
theta matrix should by multiplied by the keying cross-product, i.e.
theta <- theta* t(t(keys)) %*% t(keys)
and finaly the total score with obs.var = TRUE should be the weighted sum (I could forget something; not sure about Green-Yang ordinal correction). 

This would be very helpful as recently, I have to fit a new model with reverse-coded items to obtain reliability. 
This improvement could also serve for excluding variables from the reliability estimation, or weightening, if number of points per item differ (which is not a problem for estimating omega with continuous items, but is a serious problem in ordinal CFA now). 

What do you think about that?

Terrence Jorgensen

unread,
Apr 14, 2025, 11:34:39 AM4/14/25
to lavaan
Alexander Robitzsch requested the same feature last month.  It's been on my TODO list for a while, but I just created an issue on GitHub to make sure I don't forget.  You can keep track of it here:


I hope to have time for it this summer.

Terrence D. Jorgensen    (he, him, his)
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam
http://www.uva.nl/profile/t.d.jorgensen

Terrence Jorgensen

unread,
Feb 14, 2026, 6:08:55 AM (6 days ago) Feb 14
to lavaan
 As I just announced here, semTools 0.5-8 is on its way to CRAN, with a new compRelSEM(..., W=) argument that allows users to easily provide custom weights by specifying composites via lavaan syntax.  Composites are specified with the "<~" operator
  • any observed indicators on the right-hand side are given weights of 1 by default (unless a different value is specified)
  • any observed indicators omitted from the right-hand side are given weights of 0
This makes it pretty easy to specify weights in accordance with reverse-coding (e.g., for a composite of 2 positively worded items and 2 negatively worded items):

myWeights <- ' myComposite <~ pos1 + pos2 + (-1)*neg3 + (-1)*neg4 '
compRelSEM(fit, W = myWeights)

The parentheses around -1 aren't necessary, but I think it helps readability since simply writing pos1 + pos2 - neg3 - negdoes not work (because "-" is not a syntactical operator like "+" is in lavaan syntax).

not sure about Green-Yang ordinal correction

Neither was I, but I visited Zhenqiu (Laura) Lu at UGA in September, who pointed me to her IMPS 2020 Proceedings chapter that reports how weights can be quite simply added to Green & Yang's (2009, Eq. 21) original formula (see final formula in Section 4 of Lu et al., 2021).  So that is also implemented in the update, and cited on the help-page documentation.  

Eventually, I want to rewrite the semTools::maximalRelia() function (which numerically searches for optimal weights) to call compRelSEM() for a specified (list of) composite(s).

Anyway, I hope this helps your research.  Happy to hear feedback.

Best,
Reply all
Reply to author
Forward
0 new messages