utilities {elisr} | R Documentation |
Miscellaneous utility functions
Description
A set of utility functions to calculate characteristic values of classical test theory, reverse a variable, and extract the relevant bits from various objects.
calc_rit()
calculates the corrected item-total
correlation of a scale or fragment using a part-whole correction. Thus, the
item itself is excluded in the calculation process.
calc_rbar()
calculates the average correlation of a
fragment or scale.
calc_alpha()
calculates the internal consistency of a
scale or fragment using Cronbach's alpha.
rvrs_var()
reverses an item using the specified scaling values. It
handles the following types of scales:
...-3 -2 -1 0 1 2 3..., e.g.,
sclvals = c(-3, 3)
0 1 2 3 4 5 6..., e.g.,
sclvals = c(0, 7)
1 2 3 4 5 6 7..., e.g.,
sclcals = c(1, 7)
rvrs_note()
gets the full report of reversed variables
and reports a unique list of them.
extr_core()
is used to extract all pairs of core items from a
fragment.
extr_core_nms()
is used to extract the names of all pairs
of core items from a given fragment.
extreb_itms()
builds the counterpart of a fragment from
the given item names. Therefore, the counterpart includes all variables
that are not part of a fragment but which are mentioned in the specified
data set.
nme_msdf()
renames the components of a multiple scaled
data frame. The naming scheme is scl_n
. scl
stands for
'scale' and n
specifies the number of fragments or scales. For
example, the first component is called scl_1
.
Usage
calc_rit(scl, use)
calc_rbar(scl, use)
calc_alpha(scl, use)
rvrs_var(var, sclvals)
rvrs_note(msg, applicant)
extr_core(scl)
extr_core_nms(scl)
extreb_itms(df, itm_nms)
nme_msdf(x)
Arguments
scl |
a scale within a multiple scaled data frame. |
use |
an optional string indicating how to deal with missing values, See
|
var |
a variable or item (often a column from a data frame). |
sclvals |
the start- and end point of a scale (specify:
|
msg |
a reverse message sent from either |
applicant |
the function which wants to leave messages |
df |
a data frame object. |
itm_nms |
the names of an item from a scale. |
x |
a multiple scaled data frame. |
Details
All functions are internal functions.
Value
calc_rit()
returns a numeric vector of length one. It is used
to examine the coherence between item and overall score.
calc_rbar()
returns a numeric vector of length one that
reports the inter-item correlation.
calc_alpha()
returns a numeric vector of length one which is
used to assess the internal consistency of a scale.
rvrs_var()
returns the reversed numeric vector using the above
reversing scheme.
rvrs_note()
is called for its side effects. It leaves a
message when an item is reversed.
extr_core()
returns a numeric vector of length two, which
contains the two items with the highest correlation in a fragment or scale.
extr_core_nms()
returns character vector of length two, which
contains the names of the two items with the highest correlation in a
fragment or scale.
extrev_itms()
returns vector of length m minus two, where 'm'
specifies the number of variables in a given data set. It contains the
items of a scale's counterpart.
nme_msdf()
returns a character vector that numbers each
element of its input according to the above naming scheme.