Comments (1)
Few more issues:
Applies to dEntropy
1. The final calculation in dEntropy
is:
abs(sum(lxmx * log(lxmx)) / sum(lxmx))
When lxmx == 0
, the lxmx * log(lxmx)
part yields NaN
(i.e. 0 * -Inf
). To get around this, instances of lxmx == 0
are first converted to 1. This trick works fine in the numerator, because the limit of x * log(x)
as x approaches 0 is 0, and correspondingly 1 * log(1) == 0
.
But the extra 1s added to lxmx
are also getting carried into the denominator (R0 = sum(lxmx)
), which is not correct. Suggest editing so that denominator is calculated before 0s are converted to 1s in lxmx
.
2. There's a lot of code duplication in the final three blocks that calculate entropy with respect to the different types of reproduction: Fec
, Clo
, and FecClo
. Suggest pulling the duplicated sections into a separate utility function that calculates entropy given vectors lx and fx (where fx is one of mx, cx, or mxcx).
Applies to kEntropy
3. When argument trapeze == TRUE
, I think the kEntropy
function currently implements the 'midpoint approximation' to a definite integral rather than the 'trapezoidal approximation', as advertised.
Some details on the two approximations below:
http://tutorial.math.lamar.edu/Classes/CalcII/ApproximatingDefIntegrals.aspx
https://www.r-bloggers.com/the-trapezoidal-rule-of-numerical-integration-in-r/
4. The kEntropy
function returns NaN
if any values of lx are 0 (due to the same log(0)
issue described for dEntropy
). Suggest adding code to omit late age-classes at/after which survivorship has fallen to 0.
from rage.
Related Issues (20)
- Finish adding stage name support HOT 2
- Add unit tests for the new life_expect functions (life_expect_mean and life_expect_var)
- Tidy up the Life History vignette ready for publication HOT 1
- Change name of vitalRates function to vital_rates for consistency HOT 1
- Clarify in relevant functions what the units are HOT 1
- Formatting of "#' @section Warning: " in d_entropy function HOT 1
- Packages in Suggests should be used conditionally HOT 2
- Fix Ternary Plots vignette (it is currently removed).
- mpm_collapse bug - NaN column in output
- Standardise life table column names and terminology HOT 1
- Standardise the default lx_crit value across functions HOT 1
- Remove dependency on popbio HOT 1
- plot_life_cycle - remove excess white space from around diagram
- Add space ("\n\n") to warnings/messages HOT 1
- Allow entropy functions to use matrices as inputs directly (rather than first having to calculate lx/mx trajectories). HOT 1
- Standardise use of matR, matF and matC.
- Allow plot_life_cycle to work with NA values?
- Add generation time calculation methods
- entropy_d is calculating the wrong formula HOT 1
- update R CMD check GitHub Actions to latest versions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rage.