All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.finmath.climate.models.dice.submodels.EvolutionOfProductivity Maven / Gradle / Ivy

Go to download

finmath lib is a Mathematical Finance Library in Java. It provides algorithms and methodologies related to mathematical finance.

There is a newer version: 6.0.19
Show newest version
package net.finmath.climate.models.dice.submodels;

import java.util.function.Function;

import net.finmath.time.TimeDiscretization;

/**
 * The evolution of the productivity (economy)
 * \(
 * 	A(t_{i+1}) = A(t_{i}) / (1 - ga * \exp(- deltaA * t))
 * \)
 *
 * @author Christian Fries
 */
public class EvolutionOfProductivity implements Function> {

	private final TimeDiscretization timeDiscretization;
	private final double productivityGrowthRateInitial;        	// ga: Initial TFP rate
	private final double productivityGrowthRateDecayRate;	// deltaA: TFP increase rate

	/**
	 * The evolution of the productivity (economy)
	 * \(
	 * 	A(t_{i+1}) = A(t_{i}) / (1 - ga * \exp(- deltaA * t))
	 * \)
	 * 
	 * @param timeDiscretization The time discretization.
	 * @param productivityGrowthRateInitial The initial productivity growth rate ga per 1Y.
	 * @param productivityGrowthRateDecayRate The productivity growth decay rate per 1Y.
	 */
	public EvolutionOfProductivity(TimeDiscretization timeDiscretization, double productivityGrowthRateInitial, double productivityGrowthRateDecayRate) {
		super();
		this.timeDiscretization = timeDiscretization;
		this.productivityGrowthRateInitial = productivityGrowthRateInitial;
		this.productivityGrowthRateDecayRate = productivityGrowthRateDecayRate;
	}

	public EvolutionOfProductivity(TimeDiscretization timeDiscretization) {
		// Parameters from original model: initial productivity growth 0.076 per 5 years, decaying with 0.005 per 1 year.
		this(timeDiscretization, 1-Math.pow(1-0.076,1.0/5.0), 0.005);
	}

	@Override
	public Function apply(Integer timeIndex) {
		double time = timeDiscretization.getTime(timeIndex);
		double timeStep = timeDiscretization.getTimeStep(timeIndex);
		return (Double productivity) -> {
			double productivityGrowthRate = productivityGrowthRateInitial * Math.exp(-productivityGrowthRateDecayRate * time);
			return productivity * Math.pow(1 - productivityGrowthRate, -timeStep);
		};
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy