Code Authors: Valerie Ryan, Ro Nadreau, Sarah Forrest, and Catherine Lamoreaux
There are three code files: one for descriptive statistical analyses; one for exploratory factor analyses (EFA), confirmatory factor analyses (CFA), and bifactor analyses; and one for differential item functioning (DIF).
There were 4 experimental groups. Use the following code, found in the factor analysis code file, to create a variable denoting experimental group and to split the data into exploratory and confirmatory sets.
# create variable for experimental group
rands$exper_group = ifelse(rands$P_QOLEXP == 1 & rands$P_SOCEXP == 1, 1,
ifelse(rands$P_QOLEXP == 1 & rands$P_SOCEXP == 2, 2,
ifelse(rands$P_QOLEXP == 2 & rands$P_SOCEXP == 1, 3, 4)))
table(rands$exper_group)
# randomly assign respondents to exploratory or confirmatory groups
set.seed(72)
rands$split_group = NA
for(g in 1:4){
rands$split_group[rands$exper_group == g] = sample(c("explore", "confirm"), sum(rands$exper_group == g), replace = T)
}
table(rands$split_group, rands$exper_group)The data used in these analyses are from the National Center for Health Statistics' (NCHS) Research and Development Survey, Round 11 (RANDS 11). You can find more information about RANDS here and the data and documentation for Round 11 here when it is released.
These analyses were conducted for this paper: Assessing the Structural Validity and Measurement Invariance of the Whole Person Health Index.
If you have any questions about the code please reach out to Valerie Ryan at vryan2@cdc.gov
Please see information about our license, disclaimers, and other notices here. The repository utilizes code licensed under the terms of the Apache Software License and is free to use, redistribute, and modify.