add r2 for lavaan
m <- lavaan::sem("mpg ~ cyl
hp ~ am",
data = mtcars)
lavaan::lavInspect(m, "rsquare")
#> mpg hp
#> 0.686 0.033
performance::r2(m)
#> 'r2()' does not support models of class 'lavaan'.
#> [1] NA
Created on 2021-02-17 by the reprex package (v1.0.0)
should we return like a list with the R2 for each response?
🤷♂️
I guess it has so be somewhat consistent with other r2s...?
out of curiosity, is there a way to aggregate them to have a "unique" model-general R2 (the explained variance of the dataset made of all the responses)?
Not that I know of...
https://link.springer.com/article/10.3758/s13428-020-01532-y
In SEM we generally report individual response variable R2 by convention. FYI, this could easily be done for piecewiseSEM as well to cover all of your bases - there is a function within the package, or just lapply your way across each model piece.