Japal/zCompositions

How to handle zeros whilst ignoring NA in lrEM or lrEMplus

Closed this issue · 1 comments

Hi All,
I am using lrEM on a dataset that contains both zeros and NAs but I only want to change the zeros, when I use lrEMplus I can't seem to specify only zeros and when I use lrEM it gives me the error message

NA values not labelled as censored or missing values were found in the data set

From this I assume I can somehow censor the NA (I don't want to get rid of every row containing NA just exclude it from this function) but I can't figure out how to do this or if it is possible.

Any help would be greatly appreciated
Thanks

Hi Lissa, NA is the default label used for missing data in R. If there are missing cells in your data set, you would need to do something about them in order to proceed with data analysis anyway, not sure why you say that you would want to keep the NAs. The package allows you to impute these along with the zeros by means of the lrEMplus function.

Moreover, zCompositions is meant to deal with zeros, censored and missing data in compositional data, which are intrinsically multivariate. It uses information from the observed part of the data set and across variables/columns, so it cannot really work if there are NAs, hence the warning/error message in lrEM.

So it seems to me that you should use lrEMplus and allow zCompositions to impute the missing (NA) along with the zeros. This does not imply to get rid of every row containing NA, but again to use the information in the data to impute the missing cells with sensible values.

Hope this helps.