Hi Neha,
One sure cure for divide by zero is to omit zeros in the denominator variable.

num<-sample(0:10,20,TRUE)
denom<-sample(0:10,20,TRUE)
zeros<-denom == 0
num[!zeros]/denom[!zeros]

If you don't want to lose those data and there are no negative values,
you could add a small number to all denominator values if that would
still give useful output.

Jim

On Wed, Jan 26, 2022 at 7:51 AM Neha gupta <neha.bologn...@gmail.com> wrote:
>
> Hello everyone
>
> I have an output variable (0/1) and I want to evaluate how the model is
> biased when we have 1 and when 0 value.
>
> The problem is that the package of R I use here is designed originally to
> check bias for input metrics. When I evaluate it for this output variable,
> it gives me NA values, probably a divide by zero problem. Can I avoid this
> issue and how (I am not very expert of R language).
>
> Warm regards
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to