me_sscore
takes a data frame with quality estimates of class
me
and estimates the quality of a sum score for
selected variables in ...
. Use me_sscore_
if you're
interested in programming with me_sscore
me_sscore(me_data, .data, new_name, ..., wt = NULL, .drop = TRUE)
me_sscore_(me_data, .data, new_name, vars_names, wt = NULL, .drop = TRUE)
a data frame of class me
containing
quality estimates from the variables specified in ...
. It is
expected that this measurement error data is not square rooted (reliability,
validity and quality) as it will be done with me_sscore
.
a data frame which contains data for the variables specified
in ...
.
a bare unquoted name or a string specifying the name of the new sum score.
bare unquoted names or separate strings specifying
the variable names from which to estimate quality of their sum score.
They all must be present in me_data
and .data
. At minimum,
it must be two or more variable names.
a non-NA numeric vector of the same length as the variables
specified in ...
. This will be used as weights in calculating the
sum scores of all variable. Be default, all variables are given the same
weight.
a logical stating whether to drop the questions that compose
the sum score (these are the variables specified in ...
) If
FALSE
it retains the original questions and the sum score.
character vector specifying the variable names from
which to estimate the quality of the sum score. They all must be present
in me_data
and .data
. At minimum, it must be two or more
variable names.
a tibble
similar to me_data
but
with a new row containing the quality of a sum score.
# Political trust example
data(ess7es)
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)
)
selected_vars <- c("trstprl", "trstplt", "trstprt")
score <- me_sscore(me_data[me_data$question %in% selected_vars, ],
ess7es,
new_name = "s1",
trstprl, trstplt, trstprt)
# Returns the quality and method effect of any given sum score
score
#> # A tibble: 1 × 6
#> question reliability validity quality method_eff quality_coef
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 s1 0 0 0.894 0.0422 NA
# State services example
me_data <-
data.frame(
question = c("stfedu", "stfhlth"),
reliability = c(0.757, 0.760),
validity = c(0.838, 0.798),
quality = c(0.635, 0.607)
)
score <- me_sscore(me_data,
ess7es,
new_name = "s2",
stfedu, stfhlth)
# Returns the quality and method effect of any given sum score
score
#> # A tibble: 1 × 6
#> question reliability validity quality method_eff quality_coef
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 s2 0 0 0.684 0.171 NA