Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a prtp parameter #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions data/validation_data_v040/welfare-RR.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"x1","x2","x3","x4","x5","x6","x7","x8","x9","x10","x11","x12"
1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0
0.8616672317221843,0.8616672317221843,0.8616672317221843,0.8616672317221843,0.8616672317221843,0.8616672317221843,0.8616672317221843,0.8616672317221843,0.8616672317221843,0.8616672317221843,0.8616672317221843,0.8616672317221843
0.7424704182237725,0.7424704182237725,0.7424704182237725,0.7424704182237725,0.7424704182237725,0.7424704182237725,0.7424704182237725,0.7424704182237725,0.7424704182237725,0.7424704182237725,0.7424704182237725,0.7424704182237725
0.6397624299064905,0.6397624299064905,0.6397624299064905,0.6397624299064905,0.6397624299064905,0.6397624299064905,0.6397624299064905,0.6397624299064905,0.6397624299064905,0.6397624299064905,0.6397624299064905,0.6397624299064905
0.5512623219373836,0.5512623219373836,0.5512623219373836,0.5512623219373836,0.5512623219373836,0.5512623219373836,0.5512623219373836,0.5512623219373836,0.5512623219373836,0.5512623219373836,0.5512623219373836,0.5512623219373836
0.47500467889652886,0.47500467889652886,0.47500467889652886,0.47500467889652886,0.47500467889652886,0.47500467889652886,0.47500467889652886,0.47500467889652886,0.47500467889652886,0.47500467889652886,0.47500467889652886,0.47500467889652886
0.4092959667198571,0.4092959667198571,0.4092959667198571,0.4092959667198571,0.4092959667198571,0.4092959667198571,0.4092959667198571,0.4092959667198571,0.4092959667198571,0.4092959667198571,0.4092959667198571,0.4092959667198571
0.35267692259855454,0.35267692259855454,0.35267692259855454,0.35267692259855454,0.35267692259855454,0.35267692259855454,0.35267692259855454,0.35267692259855454,0.35267692259855454,0.35267692259855454,0.35267692259855454,0.35267692259855454
0.30389014758779553,0.30389014758779553,0.30389014758779553,0.30389014758779553,0.30389014758779553,0.30389014758779553,0.30389014758779553,0.30389014758779553,0.30389014758779553,0.30389014758779553,0.30389014758779553,0.30389014758779553
0.2618521822196218,0.2618521822196218,0.2618521822196218,0.2618521822196218,0.2618521822196218,0.2618521822196218,0.2618521822196218,0.2618521822196218,0.2618521822196218,0.2618521822196218,0.2618521822196218,0.2618521822196218
0.2256294449735945,0.2256294449735945,0.2256294449735945,0.2256294449735945,0.2256294449735945,0.2256294449735945,0.2256294449735945,0.2256294449735945,0.2256294449735945,0.2256294449735945,0.2256294449735945,0.2256294449735945
0.19441749924541007,0.19441749924541007,0.19441749924541007,0.19441749924541007,0.19441749924541007,0.19441749924541007,0.19441749924541007,0.19441749924541007,0.19441749924541007,0.19441749924541007,0.19441749924541007,0.19441749924541007
0.16752318837314237,0.16752318837314237,0.16752318837314237,0.16752318837314237,0.16752318837314237,0.16752318837314237,0.16752318837314237,0.16752318837314237,0.16752318837314237,0.16752318837314237,0.16752318837314237,0.16752318837314237
0.1443492419747596,0.1443492419747596,0.1443492419747596,0.1443492419747596,0.1443492419747596,0.1443492419747596,0.1443492419747596,0.1443492419747596,0.1443492419747596,0.1443492419747596,0.1443492419747596,0.1443492419747596
0.12438101173358683,0.12438101173358683,0.12438101173358683,0.12438101173358683,0.12438101173358683,0.12438101173358683,0.12438101173358683,0.12438101173358683,0.12438101173358683,0.12438101173358683,0.12438101173358683,0.12438101173358683
0.10717504205928428,0.10717504205928428,0.10717504205928428,0.10717504205928428,0.10717504205928428,0.10717504205928428,0.10717504205928428,0.10717504205928428,0.10717504205928428,0.10717504205928428,0.10717504205928428,0.10717504205928428
0.09234922180093216,0.09234922180093216,0.09234922180093216,0.09234922180093216,0.09234922180093216,0.09234922180093216,0.09234922180093216,0.09234922180093216,0.09234922180093216,0.09234922180093216,0.09234922180093216,0.09234922180093216
0.0795742983009072,0.0795742983009072,0.0795742983009072,0.0795742983009072,0.0795742983009072,0.0795742983009072,0.0795742983009072,0.0795742983009072,0.0795742983009072,0.0795742983009072,0.0795742983009072,0.0795742983009072
0.06856656533317802,0.06856656533317802,0.06856656533317802,0.06856656533317802,0.06856656533317802,0.06856656533317802,0.06856656533317802,0.06856656533317802,0.06856656533317802,0.06856656533317802,0.06856656533317802,0.06856656533317802
0.059081562539337794,0.059081562539337794,0.059081562539337794,0.059081562539337794,0.059081562539337794,0.059081562539337794,0.059081562539337794,0.059081562539337794,0.059081562539337794,0.059081562539337794,0.059081562539337794,0.059081562539337794
0.0509086464390923,0.0509086464390923,0.0509086464390923,0.0509086464390923,0.0509086464390923,0.0509086464390923,0.0509086464390923,0.0509086464390923,0.0509086464390923,0.0509086464390923,0.0509086464390923,0.0509086464390923
0.0438663124478961,0.0438663124478961,0.0438663124478961,0.0438663124478961,0.0438663124478961,0.0438663124478961,0.0438663124478961,0.0438663124478961,0.0438663124478961,0.0438663124478961,0.0438663124478961,0.0438663124478961
0.037798164012839024,0.037798164012839024,0.037798164012839024,0.037798164012839024,0.037798164012839024,0.037798164012839024,0.037798164012839024,0.037798164012839024,0.037798164012839024,0.037798164012839024,0.037798164012839024,0.037798164012839024
0.03256943934912409,0.03256943934912409,0.03256943934912409,0.03256943934912409,0.03256943934912409,0.03256943934912409,0.03256943934912409,0.03256943934912409,0.03256943934912409,0.03256943934912409,0.03256943934912409,0.03256943934912409
0.028064018642703335,0.028064018642703335,0.028064018642703335,0.028064018642703335,0.028064018642703335,0.028064018642703335,0.028064018642703335,0.028064018642703335,0.028064018642703335,0.028064018642703335,0.028064018642703335,0.028064018642703335
0.024181845254857955,0.024181845254857955,0.024181845254857955,0.024181845254857955,0.024181845254857955,0.024181845254857955,0.024181845254857955,0.024181845254857955,0.024181845254857955,0.024181845254857955,0.024181845254857955,0.024181845254857955
0.020836703658687693,0.020836703658687693,0.020836703658687693,0.020836703658687693,0.020836703658687693,0.020836703658687693,0.020836703658687693,0.020836703658687693,0.020836703658687693,0.020836703658687693,0.020836703658687693,0.020836703658687693
0.017954304759796934,0.017954304759796934,0.017954304759796934,0.017954304759796934,0.017954304759796934,0.017954304759796934,0.017954304759796934,0.017954304759796934,0.017954304759796934,0.017954304759796934,0.017954304759796934,0.017954304759796934
0.015470636079870662,0.015470636079870662,0.015470636079870662,0.015470636079870662,0.015470636079870662,0.015470636079870662,0.015470636079870662,0.015470636079870662,0.015470636079870662,0.015470636079870662,0.015470636079870662,0.015470636079870662
0.013330540163923498,0.013330540163923498,0.013330540163923498,0.013330540163923498,0.013330540163923498,0.013330540163923498,0.013330540163923498,0.013330540163923498,0.013330540163923498,0.013330540163923498,0.013330540163923498,0.013330540163923498
0.011486489640409353,0.011486489640409353,0.011486489640409353,0.011486489640409353,0.011486489640409353,0.011486489640409353,0.011486489640409353,0.011486489640409353,0.011486489640409353,0.011486489640409353,0.011486489640409353,0.011486489640409353
0.009897531730657076,0.009897531730657076,0.009897531730657076,0.009897531730657076,0.009897531730657076,0.009897531730657076,0.009897531730657076,0.009897531730657076,0.009897531730657076,0.009897531730657076,0.009897531730657076,0.009897531730657076
0.008528378767237763,0.008528378767237763,0.008528378767237763,0.008528378767237763,0.008528378767237763,0.008528378767237763,0.008528378767237763,0.008528378767237763,0.008528378767237763,0.008528378767237763,0.008528378767237763,0.008528378767237763
0.007348624523444018,0.007348624523444018,0.007348624523444018,0.007348624523444018,0.007348624523444018,0.007348624523444018,0.007348624523444018,0.007348624523444018,0.007348624523444018,0.007348624523444018,0.007348624523444018,0.007348624523444018
0.006332068950081763,0.006332068950081763,0.006332068950081763,0.006332068950081763,0.006332068950081763,0.006332068950081763,0.006332068950081763,0.006332068950081763,0.006332068950081763,0.006332068950081763,0.006332068950081763,0.006332068950081763
0.005456136323290951,0.005456136323290951,0.005456136323290951,0.005456136323290951,0.005456136323290951,0.005456136323290951,0.005456136323290951,0.005456136323290951,0.005456136323290951,0.005456136323290951,0.005456136323290951,0.005456136323290951
0.00470137388158897,0.00470137388158897,0.00470137388158897,0.00470137388158897,0.00470137388158897,0.00470137388158897,0.00470137388158897,0.00470137388158897,0.00470137388158897,0.00470137388158897,0.00470137388158897,0.00470137388158897
0.0040510198178397485,0.0040510198178397485,0.0040510198178397485,0.0040510198178397485,0.0040510198178397485,0.0040510198178397485,0.0040510198178397485,0.0040510198178397485,0.0040510198178397485,0.0040510198178397485,0.0040510198178397485,0.0040510198178397485
0.0034906310320896835,0.0034906310320896835,0.0034906310320896835,0.0034906310320896835,0.0034906310320896835,0.0034906310320896835,0.0034906310320896835,0.0034906310320896835,0.0034906310320896835,0.0034906310320896835,0.0034906310320896835,0.0034906310320896835
0.0030077623783842686,0.0030077623783842686,0.0030077623783842686,0.0030077623783842686,0.0030077623783842686,0.0030077623783842686,0.0030077623783842686,0.0030077623783842686,0.0030077623783842686,0.0030077623783842686,0.0030077623783842686,0.0030077623783842686
0.0025916902822605056,0.0025916902822605056,0.0025916902822605056,0.0025916902822605056,0.0025916902822605056,0.0025916902822605056,0.0025916902822605056,0.0025916902822605056,0.0025916902822605056,0.0025916902822605056,0.0025916902822605056,0.0025916902822605056
0.002233174590996696,0.002233174590996696,0.002233174590996696,0.002233174590996696,0.002233174590996696,0.002233174590996696,0.002233174590996696,0.002233174590996696,0.002233174590996696,0.002233174590996696,0.002233174590996696,0.002233174590996696
0.0019242533677764444,0.0019242533677764444,0.0019242533677764444,0.0019242533677764444,0.0019242533677764444,0.0019242533677764444,0.0019242533677764444,0.0019242533677764444,0.0019242533677764444,0.0019242533677764444,0.0019242533677764444,0.0019242533677764444
0.0016580660725440191,0.0016580660725440191,0.0016580660725440191,0.0016580660725440191,0.0016580660725440191,0.0016580660725440191,0.0016580660725440191,0.0016580660725440191,0.0016580660725440191,0.0016580660725440191,0.0016580660725440191,0.0016580660725440191
0.0014287012027414793,0.0014287012027414793,0.0014287012027414793,0.0014287012027414793,0.0014287012027414793,0.0014287012027414793,0.0014287012027414793,0.0014287012027414793,0.0014287012027414793,0.0014287012027414793,0.0014287012027414793,0.0014287012027414793
0.0012310650103244058,0.0012310650103244058,0.0012310650103244058,0.0012310650103244058,0.0012310650103244058,0.0012310650103244058,0.0012310650103244058,0.0012310650103244058,0.0012310650103244058,0.0012310650103244058,0.0012310650103244058,0.0012310650103244058
0.001060768379516273,0.001060768379516273,0.001060768379516273,0.001060768379516273,0.001060768379516273,0.001060768379516273,0.001060768379516273,0.001060768379516273,0.001060768379516273,0.001060768379516273,0.001060768379516273,0.001060768379516273
0.0009140293530762142,0.0009140293530762142,0.0009140293530762142,0.0009140293530762142,0.0009140293530762142,0.0009140293530762142,0.0009140293530762142,0.0009140293530762142,0.0009140293530762142,0.0009140293530762142,0.0009140293530762142,0.0009140293530762142
0.0007875891423780004,0.0007875891423780004,0.0007875891423780004,0.0007875891423780004,0.0007875891423780004,0.0007875891423780004,0.0007875891423780004,0.0007875891423780004,0.0007875891423780004,0.0007875891423780004,0.0007875891423780004,0.0007875891423780004
0.0006786397560473009,0.0006786397560473009,0.0006786397560473009,0.0006786397560473009,0.0006786397560473009,0.0006786397560473009,0.0006786397560473009,0.0006786397560473009,0.0006786397560473009,0.0006786397560473009,0.0006786397560473009,0.0006786397560473009
0.0005847616399298962,0.0005847616399298962,0.0005847616399298962,0.0005847616399298962,0.0005847616399298962,0.0005847616399298962,0.0005847616399298962,0.0005847616399298962,0.0005847616399298962,0.0005847616399298962,0.0005847616399298962,0.0005847616399298962
0.0005038699434957184,0.0005038699434957184,0.0005038699434957184,0.0005038699434957184,0.0005038699434957184,0.0005038699434957184,0.0005038699434957184,0.0005038699434957184,0.0005038699434957184,0.0005038699434957184,0.0005038699434957184,0.0005038699434957184
0.0004341682193599691,0.0004341682193599691,0.0004341682193599691,0.0004341682193599691,0.0004341682193599691,0.0004341682193599691,0.0004341682193599691,0.0004341682193599691,0.0004341682193599691,0.0004341682193599691,0.0004341682193599691,0.0004341682193599691
0.00037410852767765467,0.00037410852767765467,0.00037410852767765467,0.00037410852767765467,0.00037410852767765467,0.00037410852767765467,0.00037410852767765467,0.00037410852767765467,0.00037410852767765467,0.00037410852767765467,0.00037410852767765467,0.00037410852767765467
0.0003223570594076669,0.0003223570594076669,0.0003223570594076669,0.0003223570594076669,0.0003223570594076669,0.0003223570594076669,0.0003223570594076669,0.0003223570594076669,0.0003223570594076669,0.0003223570594076669,0.0003223570594076669,0.0003223570594076669
0.00027776451500590804,0.00027776451500590804,0.00027776451500590804,0.00027776451500590804,0.00027776451500590804,0.00027776451500590804,0.00027776451500590804,0.00027776451500590804,0.00027776451500590804,0.00027776451500590804,0.00027776451500590804,0.00027776451500590804
0.0002393405807157959,0.0002393405807157959,0.0002393405807157959,0.0002393405807157959,0.0002393405807157959,0.0002393405807157959,0.0002393405807157959,0.0002393405807157959,0.0002393405807157959,0.0002393405807157959,0.0002393405807157959,0.0002393405807157959
0.00020623193562415985,0.00020623193562415985,0.00020623193562415985,0.00020623193562415985,0.00020623193562415985,0.00020623193562415985,0.00020623193562415985,0.00020623193562415985,0.00020623193562415985,0.00020623193562415985,0.00020623193562415985,0.00020623193562415985
0.00017770330106197754,0.00017770330106197754,0.00017770330106197754,0.00017770330106197754,0.00017770330106197754,0.00017770330106197754,0.00017770330106197754,0.00017770330106197754,0.00017770330106197754,0.00017770330106197754,0.00017770330106197754,0.00017770330106197754
0.00015312111149396807,0.00015312111149396807,0.00015312111149396807,0.00015312111149396807,0.00015312111149396807,0.00015312111149396807,0.00015312111149396807,0.00015312111149396807,0.00015312111149396807,0.00015312111149396807,0.00015312111149396807,0.00015312111149396807
2 changes: 1 addition & 1 deletion src/MimiRICE2010.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ function constructrice(p)
# WELFARE COMPONENT
set_param!(m, :welfare, :l, p[:l])
set_param!(m, :welfare, :elasmu, p[:elasmu])
set_param!(m, :welfare, :rr, p[:rr])
set_param!(m, :welfare, :scale1, p[:scale1])
set_param!(m, :welfare, :scale2, p[:scale2])
set_param!(m, :welfare, :alpha, p[:alpha])
set_param!(m, :welfare, :prtp, 0.015)

connect_param!(m, :welfare, :CPC, :neteconomy, :CPC)

Expand Down
18 changes: 15 additions & 3 deletions src/components/welfare_component.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,25 @@
CPC = Parameter(index=[time, regions])
l = Parameter(index=[time, regions]) # Level of population and labor
elasmu = Parameter(index=[regions]) # Elasticity of marginal utility of consumption
rr = Parameter(index=[time, regions]) # Average utility social discount rate
RR = Variable(index=[time, regions]) # Average utility social discount rate
scale1 = Parameter(index=[regions]) # Multiplicative scaling coefficient
scale2 = Parameter(index=[regions]) # Additive scaling coefficient
alpha = Parameter(index=[time, regions])

prtp = Parameter()

function run_timestep(p, v, d, t)

if is_first(t)
for r in d.regions
v.RR[t,r] = 1.
end
else
for r in d.regions
v.RR[t,r] = v.RR[t-1,r] / (1+p.prtp)^10
end
end

#Define function for PERIODU #NEED TO ADD IF STATEMENT LIKE IN JUMP MODEL OR IS THAT ONLY ISSUES WHEN ELASMU = 1.0?
for r in d.regions
if p.elasmu[r]==1.
Expand All @@ -29,9 +41,9 @@
#Define function for CEMUTOTPER
for r in d.regions
if t.t != 60
v.CEMUTOTPER[t,r] = v.PERIODU[t,r] * p.l[t,r] * p.rr[t,r]
v.CEMUTOTPER[t,r] = v.PERIODU[t,r] * p.l[t,r] * v.RR[t,r]
else
v.CEMUTOTPER[t,r] = v.PERIODU[t,r] * p.l[t,r] * p.rr[t,r] / (1. - ((p.rr[t-1,r] / (1. + 0.015)^10) / p.rr[t-1,r]))
v.CEMUTOTPER[t,r] = v.PERIODU[t,r] * p.l[t,r] * v.RR[t,r] / (1. - ((v.RR[t-1,r] / (1. + 0.015)^10) / v.RR[t-1,r]))
end
end

Expand Down
1 change: 0 additions & 1 deletion src/parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ function getrice2010parameters(filename)
p[:pbacktime] = getparam_timeseries(f, "B36:BI36", regions, T) # Backstop price
p[:cost1] = getparam_timeseries(f, "B31:BI31", regions, T) # Adjusted cost for backstop
regtree = getparam_timeseries(f, "B43:BI43", regions, T) # Regional Emissions from Land Use Change
p[:rr] = getparam_timeseries(f, "B17:BI17", regions, T) # Social Time Preference Factor

# Global Emissions from Land Use Change (Sum of regional emissions for land use change in RICE model)
etree = Array{Float64}(undef, T)
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function Truth(range::AbstractString)
end

# Test Precision
Precision = 1.0e-10
Precision = 1.0e-9

@testset "MimiRICE2010" begin

Expand Down