ID | Year | Maths | Eng | Total |
---|---|---|---|---|
1 | 2010 | 20 | 15 | 35 |
1 | 2011 | 17 | NA | 40 |
2 | 2010 | NA | NA | 46 |
2 | 2011 | NA | NA | 39 |
3 | 2010 | NA | 15 | 41 |
3 | 2011 | 18 | NA | 43 |
4 | 2010 | NA | 15 | NA |
4 | 2011 | NA | 18 | NA |
Hello, I am trying to use the mice package to impute missing data like in an example table above.
I was wondering if there is a way to consider the column ‘total’ and impute/predict missing data for the subject column?
Currently I am able to impute but as you can guess, when I am doing the total of the imputed subject values, it is not adding up to the total already present in the original data.
Is there any way to mitigate this or another method I could use instead of MICE please?
This is the code I am using below.
mydata.imp <- mice(data = mydata, m=5, maxit = 10, method = "cart", seed = 100)
Thank you