test_pcaMethods_PPCA {missCompare}R Documentation

Testing the 'pcaMethods' PPCA missing data imputation algorithm

Description

test_pcaMethods_PPCA tests the imputation accuracy of the 'pcaMethods' PPCA missing data imputation algorithm on matrices with various missing data patterns

Usage

test_pcaMethods_PPCA(X_hat, list)

Arguments

X_hat

Simulated matrix with no missingness (this matrix will be used to obtain the error between the original and imputed values). (Simulated_matrix output from the simulate function)

list

List of matrices with various missingness patterns (MCAR, MAR, MNAR and optionally, MAP). (The input is ideally the R object that was generated using the all_patterns function)

Details

This function tests the imputation accuracy of the 'pcaMethods' PPCA missing data imputation algorithm by comparing the original simulated matrix with no missingness and the imputed matrices generated by the algorithm using the matrices with MCAR, MAR, MNAR and (optionally) MAP missingness patterns. The function calculates root-mean-square error (RMSE), mean absolute error (MAE), Kolmogorov–Smirnov D test statistic (KS) between the imputed datapoints and the original datapoints (that were subsequently set to missing). The function will also calculate the cumulative computation time for imputing all datasets. The function will automatically detect whether there is a MAP matrix in the list and calculate RMSE for all matrices provided in the list.

Value

Comp_time

Computation time of imputation using method (default output)

MCAR_RMSE

Root-mean-square error (RMSE) between the indexed original values and the imputed values in an MCAR missingness pattern (default output)

MAR_RMSE

Root-mean-square error (RMSE) between the indexed original values and the imputed values in an MAR missingness pattern (default output)

MNAR_RMSE

Root-mean-square error (RMSE) between the indexed original values and the imputed values in an MNAR missingness pattern (default output)

MAP_RMSE

Root-mean-square error (RMSE) between the indexed original values and the imputed values in an MAP missingness pattern (optional output)

MCAR_MAE

Mean absolute error (MAE) between the indexed original values and the imputed values in an MCAR missingness pattern (default output)

MAR_MAE

Mean absolute error (MAE) between the indexed original values and the imputed values in an MAR missingness pattern (default output)

MNAR_MAE

Mean absolute error (MAE) between the indexed original values and the imputed values in an MNAR missingness pattern (default output)

MAP_MAE

Mean absolute error (MAE) between the indexed original values and the imputed values in an MAP missingness pattern (optional output)

MCAR_KS

Kolmogorov–Smirnov test statistic (KS) between the indexed original values and the imputed values in an MCAR missingness pattern (default output)

MAR_KS

Kolmogorov–Smirnov test statistic (KS) between the indexed original values and the imputed values in an MAR missingness pattern (default output)

MNAR_KS

Kolmogorov–Smirnov test statistic (KS) between the indexed original values and the imputed values in an MNAR missingness pattern (default output)

MAP_KS

Kolmogorov–Smirnov test statistic (KS) between the indexed original values and the imputed values in an MAP missingness pattern (optional output)

Examples

clindata_miss_mini <- clindata_miss[1:80,1:4]
cleaned <- clean(clindata_miss_mini, missingness_coding = -9)
metadata <- get_data(cleaned)
simulated <- simulate(rownum = metadata$Rows, colnum = metadata$Columns,
cormat = metadata$Corr_matrix)
miss_list <- all_patterns(simulated$Simulated_matrix,
                    MD_pattern = metadata$MD_Pattern,
                    NA_fraction = metadata$Fraction_missingness,
                    min_PDM = 2)

test_pcaMethods_PPCA(X_hat = simulated$Simulated_matrix, list = miss_list)


[Package missCompare version 1.0.3 Index]