View Javadoc

1   /*
2    * Copyright 2006 - 2012 Christina Bohk and Roland Ewald
3    *  
4    * Licensed under the Apache License, Version 2.0 (the "License"); 
5    * you may not use this file except in compliance with the License. 
6    * You may obtain a copy of the License at 
7    *  
8    *  http://www.apache.org/licenses/LICENSE-2.0
9    *  
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13   * See the License for the specific language governing permissions and 
14   * limitations under the License. 
15   */
16  package p3j.simulation.calculation.deterministic.parameters;
17  
18  import p3j.misc.math.Matrix2D;
19  
20  /**
21   * Basic parameters of the model.
22   * 
23   * Created on July 22, 2006
24   * 
25   * @author Christina Bohk
26   * @author Roland Ewald
27   * 
28   */
29  public class BasicParameters {
30  
31  	/** Number of years to be projected. */
32  	private int numOfYears;
33  
34  	/** The maximal age that is considered individually. */
35  	private int maxAge;
36  
37  	/** Year-by-year age-specific male survivors. */
38  	private Matrix2D mortXm;
39  
40  	/** Year-by-year age-specific female survivors. */
41  	private Matrix2D mortXf;
42  
43  	/**
44  	 * Year-by-year matrix with fraction of male babies that died in the first six
45  	 * months (in relation to all babies that died).
46  	 */
47  	private Matrix2D deathProbInfant1halfMale;
48  
49  	/**
50  	 * Year-by-year matrix with fraction of female babies that died in the first
51  	 * six months (TODO: NOT YET USED!!!).
52  	 */
53  	private Matrix2D deathProbInfant1halfFemale;
54  
55  	/** Year-by-year survival probability of males at ages over 100. */
56  	private Matrix2D surviveProbO100m;
57  
58  	/** Year-by-year survival probability of females at ages over 100. */
59  	private Matrix2D surviveProbO100f;
60  
61  	/** Year-by-year age-specific fertility. */
62  	private Matrix2D fertX;
63  
64  	/** Year-by-year proportion of male live births. */
65  	private Matrix2D malePropLiveBirth;
66  
67  	/** Year-by-year proportion of female live births. */
68  	private Matrix2D femalePropLiveBirth;
69  
70  	/**
71  	 * Default constructor.
72  	 * 
73  	 * @param numYears
74  	 *          number of years to be projected
75  	 * @param maximumAge
76  	 *          the maximum age to be considered
77  	 */
78  	public BasicParameters(int numYears, int maximumAge) {
79  		this.numOfYears = numYears;
80  		this.maxAge = maximumAge;
81  	}
82  
83  	/**
84  	 * Setting rate of male live birth also sets the female one (1 - male).
85  	 * 
86  	 * @param maleRateLiveBirth
87  	 *          rate of male live births
88  	 */
89  	public void setMaleRateLiveBirth(Matrix2D maleRateLiveBirth) {
90  		this.malePropLiveBirth = maleRateLiveBirth;
91  		int rows = maleRateLiveBirth.rows();
92  		int cols = maleRateLiveBirth.columns();
93  		this.femalePropLiveBirth = new Matrix2D(rows, cols);
94  		for (int i = 0; i < rows; i++) {
95  			for (int j = 0; j < cols; j++) {
96  				this.femalePropLiveBirth.setQuick(i, j,
97  				    1.0 - maleRateLiveBirth.getQuick(i, j));
98  			}
99  		}
100 	}
101 
102 	public Matrix2D getFemalePropLiveBirth() {
103 		return femalePropLiveBirth;
104 	}
105 
106 	public Matrix2D getMalePropLiveBirth() {
107 		return malePropLiveBirth;
108 	}
109 
110 	public int getNumOfYears() {
111 		return numOfYears;
112 	}
113 
114 	public void setNumOfYears(int numOfYears) {
115 		this.numOfYears = numOfYears;
116 	}
117 
118 	public Matrix2D getMortXm() {
119 		return mortXm;
120 	}
121 
122 	public void setMortXm(Matrix2D mortXm) {
123 		this.mortXm = mortXm;
124 	}
125 
126 	public Matrix2D getMortXf() {
127 		return mortXf;
128 	}
129 
130 	public void setMortXf(Matrix2D mortXf) {
131 		this.mortXf = mortXf;
132 	}
133 
134 	public Matrix2D getDeathProbInfant1halfMale() {
135 		return deathProbInfant1halfMale;
136 	}
137 
138 	public void setDeathProbInfant1halfMale(Matrix2D deathProbInfant1halfMale) {
139 		this.deathProbInfant1halfMale = deathProbInfant1halfMale;
140 	}
141 
142 	public Matrix2D getDeathProbInfant1halfFemale() {
143 		return deathProbInfant1halfFemale;
144 	}
145 
146 	public void setDeathProbInfant1halfFemale(Matrix2D deathProbInfant1halfFemale) {
147 		this.deathProbInfant1halfFemale = deathProbInfant1halfFemale;
148 	}
149 
150 	public Matrix2D getSurviveProbO100m() {
151 		return surviveProbO100m;
152 	}
153 
154 	public void setSurviveProbO100m(Matrix2D surviveProbO100m) {
155 		this.surviveProbO100m = surviveProbO100m;
156 	}
157 
158 	public Matrix2D getSurviveProbO100f() {
159 		return surviveProbO100f;
160 	}
161 
162 	public void setSurviveProbO100f(Matrix2D surviveProbO100f) {
163 		this.surviveProbO100f = surviveProbO100f;
164 	}
165 
166 	public Matrix2D getFertX() {
167 		return fertX;
168 	}
169 
170 	public void setFertX(Matrix2D fertX) {
171 		this.fertX = fertX;
172 	}
173 
174 	public int getMaxAge() {
175 		return maxAge;
176 	}
177 
178 	public void setMaxAge(int maxAge) {
179 		this.maxAge = maxAge;
180 	}
181 
182 }