Title: | Linking Patient-Reported Outcomes Measures |
---|---|
Description: | Perform scale linking to establish relationships between instruments that measure similar constructs according to the PROsetta Stone methodology, as in Choi, Schalet, Cook, & Cella (2014) <doi:10.1037/a0035768>. |
Authors: | Seung W. Choi [aut, cre] , Sangdon Lim [aut] , Benjamin D. Schalet [ctb], Aaron J. Kaat [ctb], David Cella [ctb] |
Maintainer: | Seung W. Choi <[email protected]> |
License: | GPL-3 |
Version: | 0.4.1.9000 |
Built: | 2024-11-02 05:18:32 UTC |
Source: | https://github.com/choi-phd/prosetta |
checkFrequency
is a descriptive function for checking whether all response categories in a frequency table have a frequency of at least 1.
checkFrequency(data)
checkFrequency(data)
data |
a |
checkFrequency
returns TRUE
if all response categories have a frequency of at least 1, and FALSE
if not.
checkFrequency(data_asq) # TRUE ## Not run: data_asq@response$EDANX01[data_asq@response$EDANX01 == 4] <- 3 checkFrequency(data_asq) # FALSE ## End(Not run)
checkFrequency(data_asq) # TRUE ## Not run: data_asq@response$EDANX01[data_asq@response$EDANX01 == 4] <- 3 checkFrequency(data_asq) # FALSE ## End(Not run)
compareScores
is a helper function for comparing two sets of scores.
compareScores(left, right, type = c("corr", "mean", "sd", "rmsd", "mad"))
compareScores(left, right, type = c("corr", "mean", "sd", "rmsd", "mad"))
left |
scores on the left side of comparison. |
right |
scores on the right side of comparison. This is subtracted from 'left'. |
type |
type of comparisons to include. Accepts |
compareScores
returns a data.frame
containing the comparison results.
set.seed(1) true_theta <- rnorm(100) theta_est <- true_theta + rnorm(100, 0, 0.3) compareScores(theta_est, true_theta)
set.seed(1) true_theta <- rnorm(100) theta_est <- true_theta + rnorm(100, 0, 0.3) compareScores(theta_est, true_theta)
This dataset is associated with the following objects:
response_asq
a data.frame
containing raw response data of 751 participants and 41 variables.
prosettaid
participant IDs.
EDANX01 -- MASQ11
response to items.
itemmap_asq
a data.frame
containing the item map, describing the items in each instrument.
item_order
item numeric IDs. This column refers to the column item_order
in anchor item attributes.
instrument
the instrument ID that each item belongs to.
item_id
item ID strings. This column refers to column names in raw response data, excluding the participant ID column.
item_name
new item ID strings to be used in the combined scale.
ncat
the number of response categories.
anchor_asq
a data.frame
containing anchor item parameters for 29 items.
item_order
item numeric IDs.
item_id
item ID strings. This column refers to column names in raw response data, excluding the participant ID column.
a
the discrimination (slope) parameter for the graded response model.
cb1 - cb4
the boundaries between each category-pair for the graded response model.
data_asq
a PROsetta_data
object containing the datasets above. See loadData
for creating PROsetta_data
objects.
## load datasets into a PROsetta_data object data_asq <- loadData( response = response_asq, itemmap = itemmap_asq, anchor = anchor_asq ) ## run descriptive statistics runDescriptive(data_asq) ## run item parameter calibration on the response data, linking to the anchor item parameters runLinking(data_asq, method = "FIXEDPAR")
## load datasets into a PROsetta_data object data_asq <- loadData( response = response_asq, itemmap = itemmap_asq, anchor = anchor_asq ) ## run descriptive statistics runDescriptive(data_asq) ## run item parameter calibration on the response data, linking to the anchor item parameters runLinking(data_asq, method = "FIXEDPAR")
This dataset is associated with the following objects:
response_dep
a data.frame
containing raw response data of 747 participants and 49 variables.
prosettaid
participant IDs.
EDDEP04 -- CESD20
response to items.
itemmap_dep
a data.frame
containing the item map, describing the items in each instrument.
item_order
item numeric IDs. This column refers to the column item_order
in anchor item parameters.
instrument
the instrument ID that each item belongs to.
item_id
item ID strings. This column refers to column names in raw response data, excluding the participant ID column.
item_name
new item ID strings to be used in the combined scale.
ncat
the number of response categories.
anchor_dep
a data.frame
containing anchor item parameters for 28 items.
item_order
item numeric IDs.
item_id
item ID strings. This column refers to column names in raw response data, excluding the participant ID column.
a
the discrimination (slope) parameter for the graded response model.
cb1 - cb4
the boundaries between each category-pair for the graded response model.
data_dep
a PROsetta_data
object containing the datasets above. See loadData
for creating PROsetta_data
objects.
## load datasets into a PROsetta_data object data_dep <- loadData( response = response_dep, itemmap = itemmap_dep, anchor = anchor_dep ) ## run descriptive statistics runDescriptive(data_dep) ## run item parameter calibration on the response data, linking to the anchor item parameters runLinking(data_dep, method = "FIXEDPAR")
## load datasets into a PROsetta_data object data_dep <- loadData( response = response_dep, itemmap = itemmap_dep, anchor = anchor_dep ) ## run descriptive statistics runDescriptive(data_dep) ## run item parameter calibration on the response data, linking to the anchor item parameters runLinking(data_dep, method = "FIXEDPAR")
getCompleteData
is a helper function for performing casewise deletion of missing values.
getCompleteData(data, scale = NULL, verbose = FALSE)
getCompleteData(data, scale = NULL, verbose = FALSE)
data |
a |
scale |
the index of the scale to perform casewise deletion. Leave empty or set to "combined" to perform on all scales. |
verbose |
if |
getCompleteData
returns an updated PROsetta_data
object.
d <- getCompleteData(data_asq, verbose = TRUE)
d <- getCompleteData(data_asq, verbose = TRUE)
getEscore
is a helper function for obtaining expected scores at supplied thetas.
getEscore(ipar, model, theta, is_minscore_0)
getEscore(ipar, model, theta, is_minscore_0)
ipar |
item parameters. |
model |
item model to use. |
theta |
theta values. |
is_minscore_0 |
if |
getEscore
returns a vector of expected scores.
getItemNames
is a helper function for extracting item names for a specified scale from a PROsetta_data
object.
getItemNames(d, scale_id)
getItemNames(d, scale_id)
d |
a |
scale_id |
scale IDs to extract item names. |
getItemNames
returns a vector containing item names.
getItemNames(data_asq, 1) getItemNames(data_asq, 2) getItemNames(data_asq, c(1, 2)) getItemNames(data_asq, c(2, 1))
getItemNames(data_asq, 1) getItemNames(data_asq, 2) getItemNames(data_asq, c(1, 2)) getItemNames(data_asq, c(2, 1))
getResponse
is a helper function for extracting scale-wise response from a PROsetta_data
object.
getResponse(d, scale_id = "all", person_id = FALSE)
getResponse(d, scale_id = "all", person_id = FALSE)
d |
a |
scale_id |
scale IDs to extract response. If |
person_id |
if |
getResponse
returns a data.frame
containing scale-wise response.
getResponse(data_asq) getResponse(data_asq, 1) getResponse(data_asq, 2) getResponse(data_asq, c(1, 2)) getResponse(data_asq, c(2, 1)) getResponse(data_asq, c(1, 2), person_id = TRUE)
getResponse(data_asq) getResponse(data_asq, 1) getResponse(data_asq, 2) getResponse(data_asq, c(1, 2)) getResponse(data_asq, c(2, 1)) getResponse(data_asq, c(1, 2), person_id = TRUE)
getRSSS
is a function for generating a raw-score to standard-score crosswalk table.
getRSSS(ipar, model_id, theta_grid, is_minscore_0, prior_mu_sigma)
getRSSS(ipar, model_id, theta_grid, is_minscore_0, prior_mu_sigma)
ipar |
an item parameter matrix for graded response items. Accepts both a/b and a/d format parameters. Accepts multidimensional item parameters. |
model_id |
the column name for item models. |
theta_grid |
the theta grid to use for numerical integration. |
is_minscore_0 |
if |
prior_mu_sigma |
a named list containing prior distribution parameters. All values must be in the theta metric.
|
## Free calibration without using anchor o <- runCalibration(data_asq, technical = list(NCYCLES = 1000)) ipar <- mirt::coef(o, IRTpars = TRUE, simplify = TRUE)$items ipar <- as.data.frame(ipar) ipar[, data_asq@model_id] <- data_asq@itemmap[, data_asq@model_id] items <- getItemNames(data_asq, 2) getRSSS( ipar = ipar[items, ], model_id = data_asq@model_id, theta_grid = seq(-4, 4, .1), is_minscore_0 = TRUE, prior_mu_sigma = list(mu = 0, sigma = 1) )
## Free calibration without using anchor o <- runCalibration(data_asq, technical = list(NCYCLES = 1000)) ipar <- mirt::coef(o, IRTpars = TRUE, simplify = TRUE)$items ipar <- as.data.frame(ipar) ipar[, data_asq@model_id] <- data_asq@itemmap[, data_asq@model_id] items <- getItemNames(data_asq, 2) getRSSS( ipar = ipar[items, ], model_id = data_asq@model_id, theta_grid = seq(-4, 4, .1), is_minscore_0 = TRUE, prior_mu_sigma = list(mu = 0, sigma = 1) )
getScaleSum
is a helper function for calculating instrument-wise raw sum scores from response data.
getScaleSum(data, scale_idx)
getScaleSum(data, scale_idx)
data |
a |
scale_idx |
the instrument index to obtain the raw sum scores. |
getScaleSum(data_asq, 1) getScaleSum(data_asq, 2)
getScaleSum(data_asq, 1) getScaleSum(data_asq, 2)
getTheta
is a helper function for obtaining theta estimates.
Estimates are obtained using an expected a posteriori (EAP) method.
getTheta( data, ipar, scale = "combined", theta_grid = seq(-4, 4, 0.1), prior_dist = "normal", prior_mean = 0, prior_sd = 1 )
getTheta( data, ipar, scale = "combined", theta_grid = seq(-4, 4, 0.1), prior_dist = "normal", prior_mean = 0, prior_sd = 1 )
data |
a |
ipar |
a |
scale |
the index of the scale to use. |
theta_grid |
the theta grid to use for numerical integration. (default = |
prior_dist |
the type of prior distribution. Accepts |
prior_mean |
mean of the prior distribution. (default = |
prior_sd |
SD of the prior distribution. (default = |
getTheta
returns a list
containing EAP estimates.
x <- runLinking(data_asq, method = "FIXEDPAR") o <- getTheta(data_asq, x$ipar_linked, scale = 1) o$theta o$item_idx o <- getTheta(data_asq, x$ipar_linked, scale = 2) o$theta o$item_idx o <- getTheta(data_asq, x$ipar_linked, scale = "combined") o$theta o$item_idx
x <- runLinking(data_asq, method = "FIXEDPAR") o <- getTheta(data_asq, x$ipar_linked, scale = 1) o$theta o$item_idx o <- getTheta(data_asq, x$ipar_linked, scale = 2) o$theta o$item_idx o <- getTheta(data_asq, x$ipar_linked, scale = "combined") o$theta o$item_idx
loadData
is a data loading function for creating a PROsetta_data
object, for performing scale linking/equating in the 'PROsetta' package.
loadData
assumes the response data has been reverse-coded for applicable items.
loadData( response, itemmap, anchor, item_id = NULL, person_id = NULL, scale_id = NULL, model_id = NULL, input_dir = getwd() )
loadData( response, itemmap, anchor, item_id = NULL, person_id = NULL, scale_id = NULL, model_id = NULL, input_dir = getwd() )
response |
response data containing case IDs and item responses. This can be a |
itemmap |
an item map containing item IDs and scale IDs. This can be a |
anchor |
anchor data containing item parameters for anchor items. This can be a |
item_id |
the column name to look for item IDs. Automatically determined if not specified. |
person_id |
the column name to look for case IDs. Automatically determined if not specified. |
scale_id |
the column name to look for scale IDs. Automatically determined if not specified. |
model_id |
the column name to look for model IDs. Automatically determined if not specified. |
input_dir |
the directory to look for the files. |
loadData
returns a PROsetta_data
object containing the loaded data.
This is an extension of plot
to visualize frequency distribution from PROsetta_data
object.
## S4 method for signature 'PROsetta_data,ANY' plot( x, y, scale_id = "combined", filename = NULL, title = NULL, xlim = NULL, color = "blue", nbar = 20, rug = FALSE, filetype = "pdf", savefile = FALSE, bg = "white", width = 6, height = 6, pointsize = 12 )
## S4 method for signature 'PROsetta_data,ANY' plot( x, y, scale_id = "combined", filename = NULL, title = NULL, xlim = NULL, color = "blue", nbar = 20, rug = FALSE, filetype = "pdf", savefile = FALSE, bg = "white", width = 6, height = 6, pointsize = 12 )
x |
a |
y |
unused argument, exists for compatibility with |
scale_id |
scale ID to plot. |
filename |
the filename to write if |
title |
the title of the figure. |
xlim |
the range of scores to plot. |
color |
the color to fill the histogram. (default = |
nbar |
the number of histogram bars. (default = |
rug |
if |
filetype |
the type of file to write if |
savefile |
if |
bg |
the background color to use when saving the figure as a file. (default = |
width |
the width of the plot. (default = |
height |
the height of the plot. (default = |
pointsize |
the point size to use when saving the figure as a file. (default = |
plot(data_asq) plot(data_asq, scale_id = 1) plot(data_asq, scale_id = 2)
plot(data_asq) plot(data_asq, scale_id = 1) plot(data_asq, scale_id = 2)
plotInfo
is a plotting function to visualize scale-level information.
plotInfo( object, data, theta = seq(-4, 4, 0.1), t_score = FALSE, scale_label = c(1, 2, "Combined"), color = c("red", "blue", "black"), lty = c(3, 2, 1) ) ## S4 method for signature 'SingleGroupClass' plotInfo( object, data, theta = seq(-4, 4, 0.1), t_score = FALSE, scale_label = c(1, 2, "Combined"), color = c("red", "blue", "black"), lty = c(3, 2, 1) )
plotInfo( object, data, theta = seq(-4, 4, 0.1), t_score = FALSE, scale_label = c(1, 2, "Combined"), color = c("red", "blue", "black"), lty = c(3, 2, 1) ) ## S4 method for signature 'SingleGroupClass' plotInfo( object, data, theta = seq(-4, 4, 0.1), t_score = FALSE, scale_label = c(1, 2, "Combined"), color = c("red", "blue", "black"), lty = c(3, 2, 1) )
object |
a |
data |
a |
theta |
(optional) theta values to plot on the x-axis. (default = |
t_score |
(optional) set to |
scale_label |
(optional) names of each scale. This must have three values. (default = |
color |
(optional) line colors to plot. This must have three values. (default = |
lty |
(optional) line types to plot. This must have three values. (default = |
o <- runCalibration(data_asq, technical = list(NCYCLES = 1000)) plotInfo(o, data_asq)
o <- runCalibration(data_asq, technical = list(NCYCLES = 1000)) plotInfo(o, data_asq)
runCalibration
is a function for performing item parameter calibration on the response data.
runCalibration( data, dimensions = 1, fix_method = "free", fixedpar = NULL, ignore_nonconv = FALSE, verbose = FALSE, ... )
runCalibration( data, dimensions = 1, fix_method = "free", fixedpar = NULL, ignore_nonconv = FALSE, verbose = FALSE, ... )
data |
a |
dimensions |
the number of dimensions to use. Must be 1 or 2.
If 1, use one underlying dimension for all instruments combined.
If 2, use each dimension separately for the anchor instrument and the developing instrument. Covariance between dimensions is freely estimated. (default = |
fix_method |
the type of constraints to impose. (default =
|
fixedpar |
this argument exists for backward compatibility. |
ignore_nonconv |
if |
verbose |
if |
... |
runCalibration
returns a SingleGroupClass
object containing item calibration results.
This object can be used in coef
, itemfit
, itemplot
in 'mirt' package to extract wanted information.
## Not run: out_calib <- runCalibration(data_asq) # errors ## End(Not run) out_calib <- runCalibration(data_asq, technical = list(NCYCLES = 1000)) mirt::coef(out_calib, IRTpars = TRUE, simplify = TRUE) mirt::itemfit(out_calib, empirical.plot = 1) mirt::itemplot(out_calib, item = 1, type = "info") mirt::itemfit(out_calib, "S_X2", na.rm = TRUE)
## Not run: out_calib <- runCalibration(data_asq) # errors ## End(Not run) out_calib <- runCalibration(data_asq, technical = list(NCYCLES = 1000)) mirt::coef(out_calib, IRTpars = TRUE, simplify = TRUE) mirt::itemfit(out_calib, empirical.plot = 1) mirt::itemplot(out_calib, item = 1, type = "info") mirt::itemfit(out_calib, "S_X2", na.rm = TRUE)
runCFA
is a function for performing a one-factor confirmatory factor analysis (CFA) to test unidimensionality.
runCFA(data, estimator = "WLSMV", std.lv = TRUE, scalewise = FALSE, ...)
runCFA(data, estimator = "WLSMV", std.lv = TRUE, scalewise = FALSE, ...)
data |
a |
estimator |
the estimator to be used. Passed onto |
std.lv |
if |
scalewise |
if |
... |
additional arguments to pass onto |
runCFA
returns a list containing the CFA results.
out_cfa <- runCFA(data_asq, scalewise = TRUE) lavaan::summary(out_cfa$`1` , fit.measures = TRUE, standardized = TRUE, estimates = FALSE) lavaan::summary(out_cfa$`2` , fit.measures = TRUE, standardized = TRUE, estimates = FALSE) lavaan::summary(out_cfa$`combined`, fit.measures = TRUE, standardized = TRUE, estimates = FALSE)
out_cfa <- runCFA(data_asq, scalewise = TRUE) lavaan::summary(out_cfa$`1` , fit.measures = TRUE, standardized = TRUE, estimates = FALSE) lavaan::summary(out_cfa$`2` , fit.measures = TRUE, standardized = TRUE, estimates = FALSE) lavaan::summary(out_cfa$`combined`, fit.measures = TRUE, standardized = TRUE, estimates = FALSE)
runClassical
is a function for performing a Classical Test Theory (CTT) based reliability analysis.
runClassical(data, omega = FALSE, scalewise = TRUE, ...)
runClassical(data, omega = FALSE, scalewise = TRUE, ...)
data |
a |
omega |
if |
scalewise |
if |
... |
additional arguments to pass onto |
runClassical
returns a list
containing reliability analysis results.
out_alpha <- runClassical(data_asq) out_omega <- runClassical(data_asq, omega = TRUE) # also obtain omega
out_alpha <- runClassical(data_asq) out_omega <- runClassical(data_asq, omega = TRUE) # also obtain omega
runDescriptive
is a descriptive function for obtaining descriptive statistics for each item in the dataset.
runDescriptive(data = NULL)
runDescriptive(data = NULL)
data |
a |
runDescriptive
returns a data.frame
containing descriptive statistics (mean, standard deviation, median, ...) of the items in the dataset. These are calculated with describe
in 'psych' package.
out_desc <- runDescriptive(data_asq)
out_desc <- runDescriptive(data_asq)
runEquateObserved
is a function for performing equipercentile equating between two scales.
runEquateObserved
also produces a concordance table, mapping the observed raw scores from one scale to the scores from another scale.
runEquateObserved( data, scale_from = 2, scale_to = 1, type_to = "raw", rsss = NULL, eq_type = "equipercentile", smooth = "loglinear", degrees = list(3, 1), boot = TRUE, reps = 100, verbose = FALSE, ... )
runEquateObserved( data, scale_from = 2, scale_to = 1, type_to = "raw", rsss = NULL, eq_type = "equipercentile", smooth = "loglinear", degrees = list(3, 1), boot = TRUE, reps = 100, verbose = FALSE, ... )
data |
a |
scale_from |
the scale ID of the input scale. References to |
scale_to |
the scale ID of the target scale to equate to. References to |
type_to |
the type of score to use in the target scale frequency table. Accepts |
rsss |
the RSSS table to use to map each raw score level onto a t-score or a theta. See |
eq_type |
the type of equating to be passed onto |
smooth |
the type of smoothing method to be passed onto |
degrees |
the degrees of smoothing to be passed onto |
boot |
performs bootstrapping if |
reps |
the number of replications to perform in bootstrapping. (default = |
verbose |
if |
... |
other arguments to pass onto |
runEquateObserved
returns an equate
object containing the test equating result.
The printed summary statistics indicate the distributional properties of the two supplied scales and the equated scale.
x
corresponds to scale_from
.
y
corresponds to scale_to
.
yx
corresponds to scale_from
after equating to scale_to
.
See equate
for details.
The concordance table is stored in concordance
slot.
out_eq_raw <- runEquateObserved(data_asq, scale_to = 1, scale_from = 2, eq_type = "equipercentile", smooth = "loglinear" ) out_eq_raw$concordance out_link <- runLinking(data_asq, method = "FIXEDPAR") out_rsss <- runRSSS(data_asq, out_link) out_eq_tscore <- runEquateObserved(data_asq, scale_to = 1, scale_from = 2, type_to = "tscore", rsss = out_rsss, eq_type = "equipercentile", smooth = "loglinear" ) out_eq_tscore$concordance
out_eq_raw <- runEquateObserved(data_asq, scale_to = 1, scale_from = 2, eq_type = "equipercentile", smooth = "loglinear" ) out_eq_raw$concordance out_link <- runLinking(data_asq, method = "FIXEDPAR") out_rsss <- runRSSS(data_asq, out_link) out_eq_tscore <- runEquateObserved(data_asq, scale_to = 1, scale_from = 2, type_to = "tscore", rsss = out_rsss, eq_type = "equipercentile", smooth = "loglinear" ) out_eq_tscore$concordance
runFrequency
is a descriptive function for obtaining a frequency table from the dataset.
runFrequency(data, check_frequency = TRUE)
runFrequency(data, check_frequency = TRUE)
data |
a |
check_frequency |
if |
runFrequency
returns a data.frame
containing the frequency table.
freq_asq <- runFrequency(data_asq) freq_dep <- runFrequency(data_dep)
freq_asq <- runFrequency(data_asq) freq_dep <- runFrequency(data_dep)
runLinking
is a function for obtaining item parameters from the response data in the metric of supplied anchor item parameters.
runLinking(data, method, verbose = FALSE, ...)
runLinking(data, method, verbose = FALSE, ...)
data |
a |
method |
the linking method to use. Accepts:
Linear transformation methods (i.e., MM, MS, HB, SL) are performed with |
verbose |
if |
... |
runLinking
returns a list
containing the scale linking results.
constants
linear transformation constants. Only available when linear transformation methods were used (i.e., MM, MS, HB, SL).
ipar_linked
item parameters calibrated to the response data, and linked to the metric of anchor item parameters.
ipar_anchor
anchor item parameters used in linking.
out_link <- runLinking(data_asq, "SL", technical = list(NCYCLES = 1000)) out_link$constants # transformation constants out_link$ipar_linked # item parameters linked to anchor out_link <- runLinking(data_asq, "FIXEDPAR") out_link$ipar_linked # item parameters linked to anchor
out_link <- runLinking(data_asq, "SL", technical = list(NCYCLES = 1000)) out_link$constants # transformation constants out_link$ipar_linked # item parameters linked to anchor out_link <- runLinking(data_asq, "FIXEDPAR") out_link$ipar_linked # item parameters linked to anchor
runRSSS
is a function for generating raw-score to standard-score crosswalk tables from supplied calibrated item parameters.
runRSSS( data, ipar_linked, prior_mean = 0, prior_sd = 1, min_theta = -4, max_theta = 4, inc = 0.05, min_score = 1 )
runRSSS( data, ipar_linked, prior_mean = 0, prior_sd = 1, min_theta = -4, max_theta = 4, inc = 0.05, min_score = 1 )
data |
a |
ipar_linked |
an object returned from |
prior_mean |
prior mean. (default = |
prior_sd |
prior standard deviation. (default = |
min_theta |
the lower limit of theta quadratures for numerical integration. (default = |
max_theta |
the upper limit of theta quadratures for numerical integration. (default = |
inc |
the increment between theta quadratures for numerical integration. (default = |
min_score |
minimum item score (0 or 1) for each scale (1, 2, and combined). If a single value is supplied, the value is applied to all scales. (default = |
runRSSS
returns a list
containing crosswalk tables.
out_link <- runLinking(data_asq, method = "FIXEDPAR") score_table <- runRSSS(data_asq, out_link)
out_link <- runLinking(data_asq, method = "FIXEDPAR") score_table <- runRSSS(data_asq, out_link)