Difference between revisions of "Impact Calculation Tool for R"
(Created page with "=Life table calculations= ==Input data== ===Population structure in the beginning of the assessment follow-up period (pop_data)=== <t2b name="population" index="Age" desc="...") |
|||
Line 110: | Line 110: | ||
===Annual birth rate (birth_rate)=== | ===Annual birth rate (birth_rate)=== | ||
− | <t2b name="birth.rate" index="Follow-up period | + | <t2b name="birth.rate" index="Follow-up period" desc="Kuvaus" unit="-"> |
− | 2010 57000 | + | 2010|57000| |
− | 2011 57000 | + | 2011|57000| |
− | 2012 57000 | + | 2012|57000| |
− | 2013 57000 | + | 2013|57000| |
− | 2014 57000 | + | 2014|57000| |
− | 2015 57000 | + | 2015|57000| |
− | 2016 57000 | + | 2016|57000| |
− | 2017 57000 | + | 2017|57000| |
− | 2018 57000 | + | 2018|57000| |
− | 2019 57000 | + | 2019|57000| |
− | 2020 57000 | + | 2020|57000| |
− | 2021 57000 | + | 2021|57000| |
− | 2022 57000 | + | 2022|57000| |
− | 2023 57000 | + | 2023|57000| |
− | 2024 57000 | + | 2024|57000| |
− | 2025 57000 | + | 2025|57000| |
− | 2026 57000 | + | 2026|57000| |
− | 2027 57000 | + | 2027|57000| |
− | 2028 57000 | + | 2028|57000| |
− | 2029 57000 | + | 2029|57000| |
</t2b> | </t2b> | ||
===Mortality rate=== | ===Mortality rate=== | ||
− | |||
===Mortality risk (mort_risk)=== | ===Mortality risk (mort_risk)=== | ||
Line 151: | Line 150: | ||
==Analytica codes== | ==Analytica codes== | ||
+ | |||
+ | '''Indices used in the model:''' | ||
===Follow-up year (fu_year)=== | ===Follow-up year (fu_year)=== | ||
sequence(Start_year,Start_year+(Followup_time-1),1) | sequence(Start_year,Start_year+(Followup_time-1),1) | ||
− | |||
===Year in life table (year_lt)=== | ===Year in life table (year_lt)=== | ||
sequence(Start_year,Start_year+Followup_time+99,1) | sequence(Start_year,Start_year+Followup_time+99,1) | ||
− | |||
===Follow-up period in 5-year time steps (fu_period)=== | ===Follow-up period in 5-year time steps (fu_period)=== | ||
Line 166: | Line 165: | ||
sequence(Start_year,Start_year+(Followup_time-1),5) | sequence(Start_year,Start_year+(Followup_time-1),5) | ||
− | + | ===5-year period in life table (period_lt)=== | |
− | ===5-year period in life table (period_lt) | ||
sequence(Start_year,Start_year+Followup_time+99,5) | sequence(Start_year,Start_year+Followup_time+99,5) | ||
− | |||
===Age of child (age_child)=== | ===Age of child (age_child)=== | ||
Line 177: | Line 174: | ||
− | + | '''Variables, which need to be translated into ovariables:''' | |
− | |||
===Population in time, child (pop_in_time_child)=== | ===Population in time, child (pop_in_time_child)=== | ||
var k: Birth_rate[Fu_year=Year_lt]; | var k: Birth_rate[Fu_year=Year_lt]; | ||
+ | |||
k:= if k = null then 0 else k; | k:= if k = null then 0 else k; | ||
+ | |||
var a:= if @Year_lt = 1 then Pop_data else (if @Age=1 then k else 0); | var a:= if @Year_lt = 1 then Pop_data else (if @Age=1 then k else 0); | ||
+ | |||
a:= a[Age=age_child]; | a:= a[Age=age_child]; | ||
Line 190: | Line 189: | ||
j:=j[Fu_period=Period_lt]; | j:=j[Fu_period=Period_lt]; | ||
+ | |||
j:= Si_pi(j, 5, Period_lt, Year_lt, Year_help)*5; | j:= Si_pi(j, 5, Period_lt, Year_lt, Year_help)*5; | ||
+ | |||
+ | j:= if j = null then j[Period_lt=max(Fu_period)] else j; | ||
j:= if j < 0 then 0 else j; | j:= if j < 0 then 0 else j; | ||
+ | |||
j:= if j > 1 then 1 else j; | j:= if j > 1 then 1 else j; | ||
Line 198: | Line 201: | ||
var x:= 1; | var x:= 1; | ||
+ | |||
while x<= min([size(age_child),size(Year_lt)]) do ( | while x<= min([size(age_child),size(Year_lt)]) do ( | ||
+ | |||
var b:= a*j; | var b:= a*j; | ||
b:= b[@age_child=@age_child-1, @Year_lt=@Year_lt-1]; | b:= b[@age_child=@age_child-1, @Year_lt=@Year_lt-1]; | ||
+ | |||
a:= if b=null then a else b; | a:= if b=null then a else b; | ||
+ | |||
x:= x+1); | x:= x+1); | ||
Line 210: | Line 217: | ||
var a:= sum(if floor(Age/5)+1 = @Age_cat then Pop_data else 0 , Age); | var a:= sum(if floor(Age/5)+1 = @Age_cat then Pop_data else 0 , Age); | ||
+ | |||
a:= if @Age_cat=1 then sum(Pop_in_time_child, Age_child) else (if @period_lt = 1 then a else 0); | a:= if @Age_cat=1 then sum(Pop_in_time_child, Age_child) else (if @period_lt = 1 then a else 0); | ||
− | var j:= | + | var j:= Mort_risk; |
− | + | ||
j:=j[Fu_period=Period_lt]; | j:=j[Fu_period=Period_lt]; | ||
− | j:= if j = null then j[ | + | |
+ | j:= if j = null then j[Period_lt=max(Fu_period)] else j; | ||
j:= if j < 0 then 0 else j; | j:= if j < 0 then 0 else j; | ||
+ | |||
j:= if j > 1 then 1 else j; | j:= if j > 1 then 1 else j; | ||
Line 223: | Line 233: | ||
j:= sum(if floor(Age/5)+1 = @Age_cat then j else 0 , Age)/5; | j:= sum(if floor(Age/5)+1 = @Age_cat then j else 0 , Age)/5; | ||
+ | |||
var m:=j[@Age_cat=@Age_cat+1]; | var m:=j[@Age_cat=@Age_cat+1]; | ||
+ | |||
m:= if m=null then 0 else m; | m:= if m=null then 0 else m; | ||
+ | |||
var n:=((j^5)+(j^4*m)+(j^3*m^2)+(j^2*m^3)+(j*m^4))/5; | var n:=((j^5)+(j^4*m)+(j^3*m^2)+(j^2*m^3)+(j*m^4))/5; | ||
var x:= 1; | var x:= 1; | ||
+ | |||
while x<= min([size(Age_cat),size(Period_lt)]) do ( | while x<= min([size(Age_cat),size(Period_lt)]) do ( | ||
var b:= a*n; | var b:= a*n; | ||
+ | |||
b:= b[@Age_cat=@Age_cat-1, @Period_lt=@Period_lt-1]; | b:= b[@Age_cat=@Age_cat-1, @Period_lt=@Period_lt-1]; | ||
+ | |||
a:= if b=null then a else b; | a:= if b=null then a else b; | ||
+ | |||
x:= x+1); | x:= x+1); | ||
+ | |||
a | a |
Revision as of 11:12, 8 July 2013
Contents
- 1 Life table calculations
- 1.1 Input data
- 1.2 Analytica codes
- 1.2.1 Follow-up year (fu_year)
- 1.2.2 Year in life table (year_lt)
- 1.2.3 Follow-up period in 5-year time steps (fu_period)
- 1.2.4 5-year period in life table (period_lt)
- 1.2.5 Age of child (age_child)
- 1.2.6 Population in time, child (pop_in_time_child)
- 1.2.7 Population in time, beginning of time step (pop_in_time_beg)
Life table calculations
Input data
Population structure in the beginning of the assessment follow-up period (pop_data)
Obs | Age | Result | Kuvaus |
---|---|---|---|
1 | 0 | 56683 | |
2 | 1 | 56683 | |
3 | 2 | 56683 | |
4 | 3 | 5668 | |
5 | 4 | 56683 | |
6 | 5 | 60615 | |
7 | 6 | 60615 | |
8 | 7 | 60615 | |
9 | 8 | 60615 | |
10 | 9 | 60615 | |
11 | 10 | 66167 | |
12 | 11 | 66167 | |
13 | 12 | 66167 | |
14 | 13 | 6616 | |
15 | 14 | 66167 | |
16 | 15 | 63786 | |
17 | 16 | 63786 | |
18 | 17 | 63786 | |
19 | 18 | 63786 | |
20 | 19 | 63786 | |
21 | 20 | 66423 | |
22 | 21 | 66423 | |
23 | 22 | 66423 | |
24 | 23 | 66424 | |
25 | 24 | 66423 | |
26 | 25 | 65882 | |
27 | 26 | 65882 | |
28 | 27 | 65882 | |
29 | 28 | 65882 | |
30 | 29 | 65882 | |
31 | 30 | 61495 | |
32 | 31 | 61495 | |
33 | 32 | 61495 | |
34 | 33 | 61495 | |
35 | 34 | 61495 | |
36 | 35 | 72474 | |
37 | 36 | 72474 | |
38 | 37 | 72474 | |
39 | 38 | 72474 | |
40 | 39 | 72474 | |
41 | 40 | 75917 | |
42 | 41 | 75917 | |
43 | 42 | 75917 | |
44 | 43 | 75917 | |
45 | 44 | 75917 | |
46 | 45 | 76977 | |
47 | 46 | 76977 | |
48 | 47 | 76977 | |
49 | 48 | 76977 | |
50 | 49 | 76977 | |
51 | 50 | 80206 | |
52 | 51 | 80206 | |
53 | 52 | 80206 | |
54 | 53 | 80206 | |
55 | 54 | 80206 | |
56 | 55 | 80291 | |
57 | 56 | 80291 | |
58 | 57 | 80291 | |
59 | 58 | 80291 | |
60 | 59 | 80291 | |
61 | 60 | 54300 | |
62 | 61 | 54300 | |
63 | 62 | 54300 | |
64 | 63 | 54300 | |
65 | 64 | 54300 | |
66 | 65 | 48077 | |
67 | 66 | 48077 | |
68 | 67 | 48077 | |
69 | 68 | 48077 | |
70 | 69 | 48077 | |
71 | 70 | 41475 | |
72 | 71 | 41475 | |
73 | 72 | 41475 | |
74 | 73 | 41475 | |
75 | 74 | 41475 | |
76 | 75 | 34987 | |
77 | 76 | 34987 | |
78 | 77 | 34987 | |
79 | 78 | 34987 | |
80 | 79 | 34987 | |
81 | 80 | 23300 | |
82 | 81 | 23300 | |
83 | 82 | 23300 | |
84 | 83 | 23300 | |
85 | 84 | 23300 | |
86 | 85 | 11292 | |
87 | 86 | 11292 | |
88 | 87 | 11292 | |
89 | 88 | 11292 | |
90 | 89 | 11292 | |
91 | 90 | 4394 | |
92 | 91 | 4394 | |
93 | 92 | 4394 | |
94 | 93 | 4394 | |
95 | 94 | 4394 | |
96 | 95 | 886 | |
97 | 96 | 886 | |
98 | 97 | 886 | |
99 | 98 | 886 | |
100 | 99 | 886 |
Annual birth rate (birth_rate)
Obs | Follow-up period | Result | Kuvaus |
---|---|---|---|
1 | 2010 | 57000 | |
2 | 2011 | 57000 | |
3 | 2012 | 57000 | |
4 | 2013 | 57000 | |
5 | 2014 | 57000 | |
6 | 2015 | 57000 | |
7 | 2016 | 57000 | |
8 | 2017 | 57000 | |
9 | 2018 | 57000 | |
10 | 2019 | 57000 | |
11 | 2020 | 57000 | |
12 | 2021 | 57000 | |
13 | 2022 | 57000 | |
14 | 2023 | 57000 | |
15 | 2024 | 57000 | |
16 | 2025 | 57000 | |
17 | 2026 | 57000 | |
18 | 2027 | 57000 | |
19 | 2028 | 57000 | |
20 | 2029 | 57000 |
Mortality rate
Mortality risk (mort_risk)
Mortality rate/Population
Start year (start-year)
2010
Follow-up time in years (followup_time)
20
Analytica codes
Indices used in the model:
Follow-up year (fu_year)
sequence(Start_year,Start_year+(Followup_time-1),1)
Year in life table (year_lt)
sequence(Start_year,Start_year+Followup_time+99,1)
Follow-up period in 5-year time steps (fu_period)
sequence(Start_year,Start_year+(Followup_time-1),5)
5-year period in life table (period_lt)
sequence(Start_year,Start_year+Followup_time+99,5)
Age of child (age_child)
sequence(0,4,1)
Variables, which need to be translated into ovariables:
Population in time, child (pop_in_time_child)
var k: Birth_rate[Fu_year=Year_lt];
k:= if k = null then 0 else k;
var a:= if @Year_lt = 1 then Pop_data else (if @Age=1 then k else 0);
a:= a[Age=age_child];
var j:= Mort_risk[Age=age_child];
j:=j[Fu_period=Period_lt];
j:= Si_pi(j, 5, Period_lt, Year_lt, Year_help)*5;
j:= if j = null then j[Period_lt=max(Fu_period)] else j;
j:= if j < 0 then 0 else j;
j:= if j > 1 then 1 else j;
j:= 1-j;
var x:= 1;
while x<= min([size(age_child),size(Year_lt)]) do (
var b:= a*j; b:= b[@age_child=@age_child-1, @Year_lt=@Year_lt-1];
a:= if b=null then a else b;
x:= x+1);
sum(if Year_lt = period_vs_year then a else 0,Year_lt)
Population in time, beginning of time step (pop_in_time_beg)
var a:= sum(if floor(Age/5)+1 = @Age_cat then Pop_data else 0 , Age);
a:= if @Age_cat=1 then sum(Pop_in_time_child, Age_child) else (if @period_lt = 1 then a else 0);
var j:= Mort_risk;
j:=j[Fu_period=Period_lt];
j:= if j = null then j[Period_lt=max(Fu_period)] else j;
j:= if j < 0 then 0 else j;
j:= if j > 1 then 1 else j;
j:= 1-j;
j:= sum(if floor(Age/5)+1 = @Age_cat then j else 0 , Age)/5;
var m:=j[@Age_cat=@Age_cat+1];
m:= if m=null then 0 else m;
var n:=((j^5)+(j^4*m)+(j^3*m^2)+(j^2*m^3)+(j*m^4))/5;
var x:= 1;
while x<= min([size(Age_cat),size(Period_lt)]) do ( var b:= a*n;
b:= b[@Age_cat=@Age_cat-1, @Period_lt=@Period_lt-1];
a:= if b=null then a else b;
x:= x+1);
a