Git Product home page Git Product logo

Comments (2)

Aariq avatar Aariq commented on September 24, 2024

Here's whats going on.

When standard deviation is low, there are zero predicted workers in the smallest size classes. Currently the code that deals with prop_foraging assumes workers of all size classes exist. Because there are zero workers in the smallest size class, it creates a divide by zero error.

foraging_index <- match(FALSE, cum_prop < prop_nforaging)
if (is.na(foraging_index)) { #i.e., no foraging workers
    wkr_larv[] <- 0
  } else if (foraging_index > 1) {
    wkr_larv[1:foraging_index - 1] <- 0
    border_case_correction <-
      1 - (prop_nforaging - max(cum_prop[1:foraging_index - 1])) / prop_wkr_size[foraging_index]
  } else if (foraging_index == 1) { #i.e only part of the smallest size class doesn't forage
    border_case_correction <-
      1 - (prop_nforaging / prop_wkr_size[1]) #if prop_foraging = 1 this equals 1
  }

  if (!is.na(foraging_index)) {
    wkr_larv[foraging_index] <-
      wkr_larv[foraging_index] * border_case_correction
  }

Here, prop_wkr_size[1] is zero.

from bumbl.

Aariq avatar Aariq commented on September 24, 2024

replaced "1" with a min_wkr_index (the first instance of a non-zero proportion in prop_wkr_size), but still didn't fix it because when prop_nforaging = 0 the foraging index is 1 when I think it should be the same as min_wrk_index

from bumbl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.