I'm building a function/package. If the users' entry data are zero inflated then the code will log-normalise them, process them, and reverse-log-normalise and bias-correct them afterwards. If they're not zero inflated it'll just process them.
Does anyone know of a test for zero inflation? Everyone knows what it IS, but the only similar question went semi-off-topic and just solved the guy's problem (How to test/prove data is zero inflated?).
Ideally I'd like something like this:
ifelse(iszeroinflated(data)=true, data_to_use<-log1p(data), data_to_use<-data)
But if that doesn't exist then whatever makes logical sense to be manually put in place of "iszeroinflated". What do we think? 30% of data are zeroes? 50? More? Less? And any consideration of the shape of the probability distribution other than the zeroes? One would expect lots of non-zero low numbers as well right? And only a few high ones?
ifelse
code is not correct syntax. It should probably bedata_to_use <- if(iszeroinflated(data)) log1p(data) else data
. $\endgroup$