covnps | R Documentation |
This function will extract covariance matrix information (if present) in the parameter estimate output of lavaan, as well as associated p-values.
This function can be useful to getting appropriate p-values when working with multilevel data, where ignoring the nested nature of the data can lead to artificially 'statistically-significant' associations.
covnps(fit, vnames)
fit |
can provide as |
vnames |
detail the variables you are associating |
There may be some fidgeting you will need to do to get the covariance matrix to be spit out when there are no predictors. If you are working with multilevel data, where you have mean-deviated all Level 1 variables (so mean = 0 for all in this set), you can predict those variables with a Level 2 variable, which should necessarily have r(L1,L2)=0, to force generation of covariances between everything.
It will frequently be useful to quickly convert the covariances to correlations,
which can be done efficiently via cov2cor(out$cov)
Will return covariances and associated pvalues in matrix form
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.