mcar_test_combined.Rd
mcar_test_combined
shows if a missing data mechanism is
MCAR by performing three classical statistic tests:
- the dummy variable test dummy_test
, Little's MCAR test
mcar_test
from package naniar
and
- the normality tests (Hawkin's test and non-parametric test included)
- TestMCARNormality
from package MissMech
.
Our null hypothesis H0 is that the missing data mechanism is MCAR.
These three tests focus on testing different aspects of MCAR mechanism.
The dummy variable test is to verify if the value of one variable is
correlated with the missingnness of another variable. Little's MCAR tet
focuses on testing the if the mean vector for each missig pattern is part of
the total mean vector. And the normality tests focuses on testing the
normality and homoscedasticity according to the variance matrix.
The conclusion of these three tests as well as their statistics will be
returned.
mcar_test_combined(df, col_cat = c(), p_val = 0.1)
Incomplete dataframe.
Categorical columns index.
Significance level.
test_results
The final results from the three tests mentioned
in 'Description'. TRUE
means that we don't have enough evidence to
reject our H0: the missing data mechanism is MCAR. And FALSE
means
that H0 is rejected, the missing data mechanism is not MCAR.
p_values
The p-values of our three tests.
result_dummy_test
The detailed result from dummy variable
test.
result_little_test
The detailed result from Little's MCAR
test.
result_missmech
The detailed result from the normality tests
(Hawkin's test and non-parametric test).
n <- 10000
mu.X <- c(1, 2, 3)
Sigma.X <- matrix(c(9, 3, 2, 3, 4, 0, 2, 0, 1), nrow = 3)
X.complete.cont <- MASS::mvrnorm(n, mu.X, Sigma.X)
rs <- generate_miss(X.complete.cont, 0.5, mechanism = "MAR1")
mcar_test_combined(data.frame(rs$X.incomp))$test_result
#> Dummy.variable.test Little.s.MCAR.test MissMech.test
#> 1 FALSE FALSE TRUE