This is the repository for the PcAux package which was formerly called "quark."
PcAux assists in automatically extracting auxiliary features for simple, principled missing data imputation.
PcAux is beta software. Please report any issues that you encounter. You may also suggest new features.
Thank you for your interest in PcAux! We hope you find our software useful!
The PcAux
package can be installed from GitHub using one of the following
methods:
pak::pkg_install("Statscamp/PcAux")
devtools::install_github("Statscamp/PcAux")
remotes::install_github("Statscamp/PcAux")
You can find detailed documentation here. We are working diligently to move the documentation directly into the package.
A basic missing data treatment using PcAux
might look like the following:
- Load the
PcAux
Library
library(PcAux)
- Load and prepare your data:
data(sample1)
# Examine the sample data
head(sample1)
summary(sample1)
# Create variables to pass as function parameters
# List of nominal variables included in imputation
myNoms <- c("male","incident")
# List of ordinal variables included in imputation
myOrds <- c("grade")
# Exclude row id variables from the imputation
myIds <- c("ID")
# List of other variables to exclude from imputation
myDrops <- c("Qual")
# List of moderators you plan on using in your analysis model
myMods <- c("grade","incident")
- Create the PcAux object by passing the raw data and function parameters to
prepData
pcaux_obj1 <-
prepData(
rawData = sample1,
moderators = myMods,
nomVars = myNoms,
ordVars = myOrds,
idVars = myIds,
dropVars = myDrops
)
- Create a set of principal component auxiliary variables
pcaux_obj2 <- createPcAux(
pcAuxData = pcaux_obj1,
nComps = c(Inf, Inf),
interactType = 2,
maxPolyPow = 1,
control = list(minItemPredCor = .3)
)
- Finally, use the principal component auxiliaries as the predictors in a multiple imputation run:
pcaux_obj3 <-
miWithPcAux(
rawData = sample1,
pcAuxData = pcaux_obj2,
nComps = c(.6, .5),
nImps = 10
)
You can work directly with the principal component auxiliaries by merging them directly back into the raw data:
outData <- mergePcAux(pcAuxData = pcaux_obj3, rawData = sample1)