7
$\begingroup$

I have a large data set containing children's scores on arithmetic tasks with a lot of missing values possibly due to the age of the children? My hypothesis is that the missingness is not completely at random but at random. I need to do a CFA and want to know whether I need to condition on age or not? I know SPSS 17 has a missing values analysis but my data is in R and is quite large. I would like to do a missing values analysis in R but have not been able to find a package that can do this. Does anyone know?

$\endgroup$

3 Answers 3

14
$\begingroup$

As @Dirk Eddelbuettel already mentioned, your questions is not very clear. In fact, I think you are asking two questions. The first question is related to your M(C)AR assumption. The second question is about (an) appropriate R package(s).

(1) "Testing" for MAR

To test if age has an effect on the missingness of your score variable, you could run a simple logistic regression model with age as a predictor variable. Your response variable is 0: score is not missing, 1: score is missing (see also @mbq's answer and @Macro's comment). Given the assumption that younger children are more likely to not report math scores, we expect to see a significant negative effect of age .

## Make up some data
set.seed(2)
## Younger children are more likely to not report math scores, 
## so I use a Poisson distribution to model that behaviour
missData <- rpois(10000, 10)
dfr <- data.frame(score=rnorm(100), age=sample(6:15, 100, replace=TRUE))
dfr <- dfr[order(dfr$age), ]
dfr$agemiss <- sort(sample(missData, 100, replace=TRUE))
dfr$miss <- ifelse(dfr$agemiss == dfr$age, 1, 0)                  

## Run the logistic regression with age as predictor
> summary(glm(miss ~ age, data=dfr, family=binomial))

[...]

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)   5.9729     1.4946   3.996 6.43e-05 ***
age          -0.7997     0.1760  -4.544 5.53e-06 ***
---
[...]

(2) (Some) Missing data related R packages

Some of these packages also have functions to explore patterns of missingness (e.g., missing.pattern.plot() in the mi package).

$\endgroup$
3
  • 1
    $\begingroup$ Interesting approach to MCAR testing! But what do you think about alternatives: Little's test for MCAR (jstor.org/discover/10.2307/2290157), implemented in BaylorEdPsych R package and tests by Jamshidian and Jalal (jstatsoft.org/v56/i06/paper), implemented in MissMech R package? $\endgroup$ Commented Aug 23, 2014 at 17:01
  • $\begingroup$ @AleksandrBlekh Thanks, I wasn't aware of those tests! $\endgroup$ Commented Aug 24, 2014 at 5:34
  • $\begingroup$ mi::missing.pattern.plot() looks like not available anymore. $\endgroup$
    – zx8754
    Commented May 16, 2019 at 10:11
7
$\begingroup$

As far as I understand your question, you want to investigate if missing values in your data appear due to some pattern. In this case, you don't need any "missing value analysis" -- this is the same problem as checking whether the score is bigger than 0.7 or whatever. Just convert your dataset into two-class factor (missing, not-missing) and look for correlations.

$\endgroup$
2
  • $\begingroup$ BTW this is the method how people artificially proliferate functions in stuff like SPSS or SAS. $\endgroup$
    – user88
    Commented Jun 16, 2011 at 16:32
  • 1
    $\begingroup$ +1. Consider "missing" as a binary outcome and see if it is associated with any of the predictor variables using, for example, logistic regression. Not sure why CFA would be necessary. Like hammering a nail with a sledgehammer. $\endgroup$
    – Macro
    Commented Jun 16, 2011 at 16:46
3
$\begingroup$

Your question is a little difficult to decipher. One approach for dealing with missing data is imputation -- and there is a substantial literature on this and an already large and growing set of packages at CRAN so you may want to start there.

$\endgroup$
2
  • $\begingroup$ Thank you for all your responses. I see that my question was indeed not very clear. What I meant to ask was, Is the missing data completely at random (MCAR) and how do I do this in R. I t $\endgroup$
    – Robert
    Commented Jun 17, 2011 at 12:21
  • $\begingroup$ The logistic regression seems to be an adequate method to test this. The reason that I won't to know the nature of the missing is because I'm performing a CFA on the complete data set (with missings) with FIML. However, if the missing is not MCAR but MAR then I would need to condition the latent variables on age (have age predict the latent variable arithmetic ability). Anyway, my problem is solved, thanks again. Cheers $\endgroup$
    – Robert
    Commented Jun 17, 2011 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.