Should I use the R^2 value provided from the summary function?

37 views
Skip to first unread message

Collin Anderson

unread,
May 22, 2023, 10:03:06 AM5/22/23
to blavaan
Hi all, I am using Blavaan for bayesian path analysis models. I am using the summary function to print model results and it gives an R^2 value. I am wondering if this R^2 is calculated for use with bayesian analysis or if it the classical R^2 because the summary function is the same for Lavaan and Blavaan. Thank you!

Mauricio Garnier-Villarreal

unread,
May 22, 2023, 5:26:42 PM5/22/23
to blavaan
It is always calculated with the Bayesian model results, but it is the same equation as what is used in lavaan. This is estimated with the point estimates of the posterior, not through all posterior draws

Collin Anderson

unread,
May 24, 2023, 3:23:49 PM5/24/23
to blavaan
Thanks Mauricio,

do you know of a way to get an R^2 appropriate for Bayesian analysis in Blavaan or otherwise?

Ed Merkle

unread,
May 24, 2023, 6:11:16 PM5/24/23
to Collin Anderson, blavaan
The R2 values reported by summary() are not necessarily inappropriate, though they rely on the posterior mean and SD as opposed to the full posterior distribution. If you wanted to do something with the full posterior distribution of R2, you could use the ppmc() function. The code below assumes that "fit" is your fitted model:

rsqfun <- function(object) lavInspect(object, 'rsquare')

out <- ppmc(fit, discFUN = rsqfun)
summary(out)

## posterior samples of R2 in a matrix:
rsqsamps <- do.call("rbind", out@obsDist[[1]])


Ed
--
You received this message because you are subscribed to the Google Groups "blavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blavaan+u...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages