TSI | R Documentation |
Conduct true score imputation on variables with psychometric error,
optionally in concert with multiple imputation for missing data. This
function calls the mice
function in the package of
the same name, using the custom imputation function
mice.impute.truescore
for imputation of mismeasured
variables. Direct calls to mice
can get complicated (see
documentation of mice.impute.truescore
for examples),
so this function was created as a convenicene function to more easily
generate those function calls.
TSI(
data,
os_names,
score_types,
se_names = NULL,
metrics = NULL,
mean = NULL,
var_ts = NULL,
reliability = NULL,
separated = rep(T, length(os_names)),
ts_names = paste0("true_", os_names),
mice_args
)
data |
Data frame on which to conduct imputation. By default, columns
with missing values which are numeric will be imputed with the |
os_names |
Character vector of names of variables in |
score_types |
Character vector specifying psychometric model(s) used
for true score imputation. Currently available options are |
se_names |
Required for |
metrics |
Character vector of metrics of true scores for
imputation. Available values are |
mean |
Numeric vector of means of true scores for imputation. Must be
specified if |
var_ts |
Numeric vector of variances of true scores for imputation.
Must be specified if |
reliability |
Required for |
separated |
Logical vector indicating whether, for variables imputed
with |
ts_names |
Optional vector of names of true score variables which
will be created. Each element of |
mice_args |
Named list of additional arguments passed to |
##############
# CTT SCORES #
mice.data=TSI(data_ctt,
os_names='w',
score_types='CTT',
reliability=0.6,
mean=0,
var_ts=1,
mice_args=list(m=5,printFlag=F))
mice.data
#analyze with imputed true scores
pool(with(mice.data,lm(true_w~y)))
#compare standard deviations of observed and imputed true scores
mice.data=complete(mice.data,'all')
sds=sapply(mice.data,function(d)apply(d,2,sd))
apply(sds,1,mean)
##############
# EAP SCORES #
set.seed(0)
mice.data=TSI(data_eap,
os_names=c('Fx','Fy'),
se_names=c('SE.Fx','SE.Fy'),
metrics='T',
score_types='EAP',
separated=T,
ts_names=c('Tx','Ty'),
mice_args=c(m=5,maxit=5,printFlag=F))
mice.data
#multiple regression with imputed true scores
pool(with(mice.data,lm(Ty~Tx+m)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.