R/me_cmv_cor.R
me_cmv_cor.Rd
me_cmv_cor
accepts an medesign
object created by
medesign
and adjusts the correlation coefficients of
common method variables with the reliability and validity coefficients
from me_data
. During measurement error correction, correlations
above 1 and below -1 can happen. Internally, this is converted to
1 and -1 at a maximum so the user should never see a correlation higher than
the maximum values.
me_cmv_cor(.medesign)
An medesign
object given by medesign
The common-method-variance corrected correlation. It is a correlation data frame but some correlation coefficients are adjusted for their shared common method variance and the quality of sum scores.
link{medesign}
and me_cmv_cov
for the same
adjustment but for a covariance matrix.
data(ess7es)
.data <- ess7es[c("trstplt", "trstprl", "trstprt")]
# Correct for measurement error for all variables
# and correct for the fact that these three variables
# share a common method
me_syntax <- "~~ .; ~ trstplt + trstprl + trstprt"
# Data from sqp
me_data <-
data.frame(
question = c("trstprl", "trstplt", "trstprt"),
reliability = c(0.812, 0.852, 0.858),
validity = c(0.959, 0.965, 0.956),
quality = c(0.779, 0.822, 0.821)
)
mdes <- medesign(me_syntax, .data, me_data)
#> Correcting for measurement error in trstprl, trstplt, trstprt. If you want to correct other variables, make sure they are both in `me_data` and `.data` and you specify their names in the model syntax (`~~`).
# Correlations adjusted for CMV
me_cmv_cor(mdes)
#> # A tibble: 3 × 4
#> rowname trstplt trstprl trstprt
#> <chr> <dbl> <dbl> <dbl>
#> 1 trstplt 1 0.771 0.984
#> 2 trstprl 0.771 1 0.704
#> 3 trstprt 0.984 0.704 1
# Original correlation
me_correlate(.data)
#> # A tibble: 3 × 4
#> rowname trstplt trstprl trstprt
#> <chr> <dbl> <dbl> <dbl>
#> 1 trstplt 1 0.649 0.842
#> 2 trstprl 0.649 1 0.598
#> 3 trstprt 0.842 0.598 1
# More elaborate with two pairs of variables
# sharing common methods
# Each pair of variables share a common method.
me_syntax <-
"~~ .
~ trstplt + trstprl + trstprt
~ stfedu + stfhlth"
me_data2 <-
data.frame(
question = c("stfedu", "stfhlth"),
reliability = c(0.870057469366248, 0.871779788708135),
validity = c(0.915423399307664, 0.893308457365092),
quality = c(0.796868872525461, 0.779102047231298)
)
me_data <- rbind(me_data, me_data2)
.data <- ess7es[c("trstplt", "trstprl", "trstprt", "stfedu", "stfhlth")]
mdes <- medesign(me_syntax, .data, me_data)
#> Correcting for measurement error in trstprl, trstplt, trstprt, stfedu, stfhlth. If you want to correct other variables, make sure they are both in `me_data` and `.data` and you specify their names in the model syntax (`~~`).
# Correlations adjusted for CMV
me_cmv_cor(mdes)
#> # A tibble: 5 × 6
#> rowname trstplt trstprl trstprt stfedu stfhlth
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 trstplt 1 0.774 0.981 0.435 0.462
#> 2 trstprl 0.774 1 0.704 0.442 0.430
#> 3 trstprt 0.981 0.704 1 0.390 0.371
#> 4 stfedu 0.435 0.442 0.390 1 0.704
#> 5 stfhlth 0.462 0.430 0.371 0.704 1
# Original correlations
me_correlate(.data)
#> # A tibble: 5 × 6
#> rowname trstplt trstprl trstprt stfedu stfhlth
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 trstplt 1 0.651 0.839 0.352 0.369
#> 2 trstprl 0.651 1 0.598 0.348 0.335
#> 3 trstprt 0.839 0.598 1 0.316 0.297
#> 4 stfedu 0.352 0.348 0.316 1 0.620
#> 5 stfhlth 0.369 0.335 0.297 0.620 1