Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imputation using imtype = "EM" and EMaglev = 1 returning "Error in .subset2(x, i, exact = exact) : attempt to select less than one element in get1index <real>" #2

Closed
Petrina95 opened this issue Oct 25, 2022 · 2 comments

Comments

@Petrina95
Copy link

Hello again!
I am trying to impute the missing data of my data set using EM aggregation type on aggregation level 1. However, there is an error that I think comes from the fact that we try to select an element from a list using agg_cols[[0]] syntax (line 279 in coin_impute.R). Is there a quick fix for this issue?
I understand that COINr is a more updated package and today I have tried to convert our COINr6 script to a corresponding script using COINr, however I have noticed that many of the functionalities we are currently using in COINr6 are missing from COINr (imputation using regression, mixed aggregation per level, Unit reports etc.), that is why for now we prefer using COINr6.

Thank you in advance,
Petrina

@bluefoxr
Copy link
Owner

HI, the EM algorithm has a limitation that you need a certain ratio of observations to variables to perform the imputation. That's why in COINr6 the imputation is performed within groups, rather than across the whole indicator set at once. So the fact that you can't choose level 1 is by design (though the error message is admittedly not helpful).

You could actually do what you want in COINr but it's up to you how to tackle it. For example, you can use the Impute() function to call the AMELIA package. Although it's not quite as easy as in COINr6, you have much more flexibility in specifying the imputation, so you can use the full power of the AMELIA package, rather than a very limited set of options in COINr6. Mixed aggregation methods by level is available in COINr. Unit reports are actually not very hard to generate - if you look at the code for unit report generation it's really simple. Then check the template used in COINr6 to see how it's set up.

The reason unit reports were removed is that you would anyway have to customise it to your needs, and I wanted to focus on doing the core job (building and analysing composite indicators) well, rather than trying to do everything. In any case they are still accessible if you are using COINr, you just convert your "coin" to a "COIN" and load COINr6.

@Petrina95
Copy link
Author

Thank you very much for your really informative answer!

I will check again COINr and hopefully I will manage to implement everything I need.

Best regards,
Petrina

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants