net.simplace.sim.components.experimental.lifestock.LifeStockFunctions

Functions to calculate lifestock population See: M. Lesnoff, 2008, DynMod: A tool for demographic projections of tropical lifestock population under Microsoft Excel, User Manual, Version 1. CIRAD, ILRI


public class LifeStockFunctions {
// Public Constructors
public LifeStockFunctions();


// Class Methods
public static double HfromP(double p, double p2);

Calculate hazard rate from probabilities
returns hazard rate
public static double PfromH(double h, double h2);

Calculate probability from hazard rates
returns probability
public static double HfromPOld(double po, double pd);

Estimates offtake hazard rate approximately from offtake and death probability ho and hd are dependent on po and ph, and therefore an equation system has to be solved. This method estimates hd by ignoring po and uses it to calculate ho by a root finding algorithm.
returns offtake hazard rate
public static double PRescaled(double p, double p2, double n);

Rescales probability to different time unit
returns rescaled probability
public static double surv(double pd, double po);

Calculates survive probability
returns survive probability
public static double gamma(double surv, double d);

Calculates the transition probability from one age class to the next one
returns transition probability
public static HashMap calculatePopulationRates(Double[] state, Double[]
pdeath, Double[] pofftake, Double[] duration, Double[] intake, Double[]
aMax, Double prol, Double parturition, Double femaleproportion, int n);

Rate function for livestock
returns hashmap containing the arrays with overall change rate dRate, dBirth, dDeath, dIntake, dOfftake [animal day-1], as well as Balance array with total, female and male balance
public static HashMap calculatePopulationRatesExcelCompatible(Double[] state,
Double[] pdeath, Double[] pofftake, Double[] duration, Double[] intake,
Double[] aMax, Double prol, Double parturition, Double femaleproportion,
int n);

Rate function for livestock (compatibility mode) Perform same calculation as in the Excel version. Differences are - sligthtly inaccurate rescaling of probabilities - calculating birth rates from next step's rate - estimate next step's rate to limit to maximal values The effect of using premature states for some rate calculations becomes negligible when calculating with higher timesteps (e.g. daily)
returns hashmap containing the arrays with overall change rate dRate, dBirth, dDeath, dIntake, dOfftake, dDeathNewBorn, dOfftakeNewBorn [animal day-1], as well as Balance array with total, female and male balance


}