HS20imps | R Documentation |
A version of the classic Holzinger and Swineford (1939) dataset, with
missing data imposed on variables x5
and x9
:
x5
is missing not at random (MNAR) by deleting the lowest 30% of
x5
values.
x9
is missing at random (MAR) conditional on age, by deleting x5
values for the youngest 30% of subjects in the data.
The data are imputed 20 times using the syntax shown in the example.
The data include only age and school variables, along with 9 tests
(x1
through x9
).
Terrence D. Jorgensen (University of Amsterdam; TJorgensen314@gmail.com)
The lavaan package.
Holzinger, K., & Swineford, F. (1939). A study in factor analysis: The stability of a bifactor solution. Supplementary Educational Monograph, no. 48. Chicago, IL: University of Chicago Press.
lavaan::HolzingerSwineford1939
data(HolzingerSwineford1939, package = "lavaan")
## impose missing data for example
HSMiss <- HolzingerSwineford1939[ , c(paste("x", 1:9, sep = ""),
"ageyr","agemo","school")]
set.seed(123)
HSMiss$x5 <- ifelse(HSMiss$x5 <= quantile(HSMiss$x5, .3), NA, HSMiss$x5)
age <- HSMiss$ageyr + HSMiss$agemo/12
HSMiss$x9 <- ifelse(age <= quantile(age, .3), NA, HSMiss$x9)
## impute missing data with Amelia
library(Amelia)
set.seed(456)
HS.amelia <- amelia(HSMiss, m = 20, noms = "school", p2s = FALSE)
HS20imps <- HS.amelia$imputations
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.