quark | R Documentation |
The quark
function provides researchers with the ability to calculate
and include component scores calculated by taking into account the variance
in the original dataset and all of the interaction and polynomial effects of
the data in the dataset.
quark(data, id, order = 1, silent = FALSE, ...)
data |
The data frame is a required component for |
id |
Identifiers and dates within the dataset will need to be
acknowledged as |
order |
Order is an optional argument provided by quark that can be
used when the imputation procedures in mice fail. Under some circumstances,
mice cannot calculate missing values due to issues with extreme missingness.
Should an error present itself stating a failure due to not having any
columns selected, set the argument |
silent |
If |
... |
additional arguments to pass to |
The quark
function calculates these component scores by first filling
in the data via means of multiple imputation methods and then expanding the
dataset by aggregating the non-overlapping interaction effects between
variables by calculating the mean of the interactions and polynomial
effects. The multiple imputation methods include one of iterative sampling
and group mean substitution and multiple imputation using a polytomous
regression algorithm (mice). During the expansion process, the dataset is
expanded to three times its normal size (in width). The first third of the
dataset contains all of the original data post imputation, the second third
contains the means of the polynomial effects (squares and cubes), and the
final third contains the means of the non-overlapping interaction effects. A
full principal componenent analysis is conducted and the individual
components are retained. The subsequent combinequark
function
provides researchers the control in determining how many components to
extract and retain. The function returns the dataset as submitted (with
missing values) and the component scores as requested for a more accurate
multiple imputation in subsequent steps.
The output value from using the quark function is a list. It will return a list with 7 components.
ID Columns |
Is a vector of the identifier columns entered when running quark. |
ID Variables |
Is a subset of the dataset that contains the identifiers as acknowledged when running quark. |
Used Data |
Is a matrix / dataframe of the data provided by user as the basis for quark to process. |
Imputed Data |
Is a matrix / dataframe of the data after the multiple method imputation process. |
Big Matrix |
Is the expanded product and polynomial matrix. |
Principal Components |
Is the entire dataframe of principal components for the dataset. This dataset will have the same number of rows of the big matrix, but will have 1 less column (as is the case with principal component analyses). |
Percent Variance Explained |
Is a vector of the percent variance explained with each column of principal components. |
Steven R. Chesnut (University of Southern Mississippi; Steven.Chesnut@usm.edu)
Danny Squire (Texas Tech University)
Terrence D. Jorgensen (University of Amsterdam)
The PCA code is copied and modified from the FactoMineR
package.
Howard, W. J., Rhemtulla, M., & Little, T. D. (2015). Using Principal Components as Auxiliary Variables in Missing Data Estimation. Multivariate Behavioral Research, 50(3), 285–299. doi: 10.1080/00273171.2014.999267
combinequark
set.seed(123321) dat <- HolzingerSwineford1939[,7:15] misspat <- matrix(runif(nrow(dat) * 9) < 0.3, nrow(dat)) dat[misspat] <- NA dat <- cbind(HolzingerSwineford1939[,1:3], dat) ## Not run: quark.list <- quark(data = dat, id = c(1, 2)) final.data <- combinequark(quark = quark.list, percent = 80) ## Example to rerun quark after imputation failure: quark.list <- quark(data = dat, id = c(1, 2), order = 2) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.