diff --git a/Projects/Agora/Designs/altscf_eff.ngd b/Projects/Agora/Designs/altscf_eff.ngd new file mode 100644 index 0000000000000000000000000000000000000000..5cfe85c51731d8b61a92f737baf6bf523dffee4b --- /dev/null +++ b/Projects/Agora/Designs/altscf_eff.ngd @@ -0,0 +1,101 @@ +Design Choice situation alt1.b alt1.c alt1.d alt1.p alt2.b alt2.c alt2.d alt2.p Block +1 1 0 1 1 41 0 0 1 71 3 +1 2 0 0 0 83 0 0 1 71 2 +1 3 1 1 0 83 0 1 0 59 3 +1 4 0 1 0 35 0 0 0 53 1 +1 5 1 0 1 77 0 0 0 59 2 +1 6 1 0 0 47 0 1 0 41 3 +1 7 0 0 0 53 0 1 1 35 1 +1 8 0 0 1 47 0 1 0 41 1 +1 9 1 1 0 59 0 1 1 83 3 +1 10 0 0 1 41 1 0 0 47 1 +1 11 0 1 0 77 1 1 0 71 3 +1 12 1 0 1 35 0 0 0 53 2 +1 13 0 1 0 41 1 0 1 41 3 +1 14 1 0 0 59 1 1 0 83 1 +1 15 0 0 0 83 1 0 1 77 1 +1 16 1 1 0 47 1 1 1 35 2 +1 17 1 0 1 83 0 1 1 47 2 +1 18 1 0 1 53 1 0 1 77 3 +1 19 1 1 1 53 0 1 1 83 1 +1 20 0 1 1 77 1 1 0 65 2 +1 21 1 0 0 53 1 0 0 65 2 +1 22 1 1 1 41 1 1 0 77 1 +1 23 0 0 0 59 1 1 1 35 2 +1 24 1 1 0 77 0 0 1 65 1 +1 25 0 1 1 35 0 0 1 71 3 +1 26 1 0 1 71 1 1 1 35 3 +1 27 0 1 1 71 0 1 1 47 1 +1 28 1 0 1 47 0 0 0 53 3 +1 29 0 1 1 71 1 0 0 59 2 +1 30 1 1 0 65 1 0 0 53 2 +1 31 0 0 1 65 1 1 1 83 2 +1 32 1 1 0 35 1 0 1 41 1 +1 33 0 0 0 65 0 0 0 59 3 +1 34 0 1 1 65 1 1 0 47 3 +1 35 1 1 1 71 1 0 1 65 1 +1 36 0 0 0 59 0 1 0 77 2 +|||||||||| +design +;alts = alt1*, alt2*, alt3 +;rows = 36 +;block = 3 +;eff = (mnl,d) +;rep = 1000 + +;con +;model: +U(alt1) = b1[-1.2] + b2[0.1] * B[0,1] + b3[0.4] * C[0,1] + b4[0.3] * D[0,1] + b5[0.02] * P[35:83:6]/ +U(alt2) = b6[-1.8] + b7[0.2]* B + b8[0.6] * C + b9[0.4] * D + b10[0.015]* P + +;formatTitle = 'Scenario <scenarionumber>' +;formatTableDimensions = 3, 6 +;formatTable: +1,1 = '' / +1,2 = 'Results' / +1,3 = 'Beratung' / +1,4 = 'Partner' / +1,5 = 'Kompensation' / +1,6 = 'Choice question&:' / +2,1 = 'alt1' / +2,2 = '<alt1.b>' / +2,3 = '<alt1.c>' / +2,4 = '<alt1.d>' / +2,5 = '<alt1.p>' / +2,6 = '' / +3,1 = 'alt2' / +3,2 = '<alt2.b>' / +3,3 = '<alt2.c>' / +3,4 = '<alt2.d>' / +3,5 = '<alt2.p>' / +3,6 = '' +;formatTableStyle: +1,1 = 'default' / +1,2 = 'headingattribute' / +1,3 = 'headingattribute' / +1,4 = 'headingattribute' / +1,5 = 'headingattribute' / +1,6 = 'headingattribute' / +2,1 = 'heading1' / +2,2 = 'body1' / +2,3 = 'body1' / +2,4 = 'body1' / +2,5 = 'body1' / +2,6 = 'choice1' / +3,1 = 'heading2' / +3,2 = 'body2' / +3,3 = 'body2' / +3,4 = 'body2' / +3,5 = 'body2' / +3,6 = 'choice2' +;formatStyleSheet = Default.css +;formatAttributes: +alt1.b(0=Results, 1=Action) / +alt1.c(0=Keine Beratung, 1=Mit Beratung) / +alt1.d(0=Keine Partner, 1=Mit Partner) / +alt1.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) / +alt2.b(0=Results, 1=Action) / +alt2.c(0=Keine Beratung, 1=Mit Beratung) / +alt2.d(0=Keine Partner, 1=Mit Partner) / +alt2.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) +$ \ No newline at end of file diff --git a/Projects/Agora/Designs/befficientdesign.ngd b/Projects/Agora/Designs/befficientdesign.ngd new file mode 100644 index 0000000000000000000000000000000000000000..e2c1f83761abba23ac4acbf0d3e789790c4c3618 --- /dev/null +++ b/Projects/Agora/Designs/befficientdesign.ngd @@ -0,0 +1,83 @@ +Design Choice situation alt1.b alt1.c alt1.d alt1.p alt2.b alt2.c alt2.d alt2.p Block +1 1 1 0 1 53 0 1 0 59 1 +1 2 1 1 0 71 0 0 1 47 2 +1 3 1 0 0 53 0 1 1 71 2 +1 4 0 0 0 77 1 1 1 35 2 +1 5 0 1 1 65 1 0 0 59 2 +1 6 0 1 0 35 1 0 1 83 2 +1 7 1 1 1 59 0 0 0 65 1 +1 8 1 1 1 35 0 0 0 83 2 +1 9 0 0 1 47 1 1 0 65 2 +1 10 0 0 1 41 1 1 0 77 1 +1 11 1 1 0 59 0 0 1 53 1 +1 12 1 0 1 71 0 1 0 47 1 +1 13 1 0 0 83 0 1 1 35 2 +1 14 1 0 0 47 0 1 1 71 1 +1 15 0 0 1 77 1 1 0 41 1 +1 16 0 1 0 41 1 0 1 77 1 +1 17 0 1 1 65 1 0 0 53 2 +1 18 0 1 0 83 1 0 1 41 1 +|||||||||| +design +;alts = alt1*, alt2*, alt3 +;rows = 18 +;block = 2 +;eff = (mnl,d,mean) +;rep = 1000 +;bdraws = halton(1000) +;con +;model: +U(alt1) = b1[(n,-1.2,0.1)] + b2[(n,0.1,0.02)] * B[0,1] + b3[(n,0.4,0.1)] * C[0,1] + b4[(n,0.3,0.1)] * D[0,1] + b5[(n,0.02,0.001)] * P[35:83:6]/ +U(alt2) = b6[(n,-1.4,0.1)] + b2 * B + b3 * C + b4 * D + b5 * P + +;formatTitle = 'Scenario <scenarionumber>' +;formatTableDimensions = 3, 6 +;formatTable: +1,1 = '' / +1,2 = 'Results' / +1,3 = 'Beratung' / +1,4 = 'Partner' / +1,5 = 'Kompensation' / +1,6 = 'Choice question&:' / +2,1 = 'alt1' / +2,2 = '<alt1.b>' / +2,3 = '<alt1.c>' / +2,4 = '<alt1.d>' / +2,5 = '<alt1.p>' / +2,6 = '' / +3,1 = 'alt2' / +3,2 = '<alt2.b>' / +3,3 = '<alt2.c>' / +3,4 = '<alt2.d>' / +3,5 = '<alt2.p>' / +3,6 = '' +;formatTableStyle: +1,1 = 'default' / +1,2 = 'headingattribute' / +1,3 = 'headingattribute' / +1,4 = 'headingattribute' / +1,5 = 'headingattribute' / +1,6 = 'headingattribute' / +2,1 = 'heading1' / +2,2 = 'body1' / +2,3 = 'body1' / +2,4 = 'body1' / +2,5 = 'body1' / +2,6 = 'choice1' / +3,1 = 'heading2' / +3,2 = 'body2' / +3,3 = 'body2' / +3,4 = 'body2' / +3,5 = 'body2' / +3,6 = 'choice2' +;formatStyleSheet = Default.css +;formatAttributes: +alt1.b(0=Results, 1=Action) / +alt1.c(0=Keine Beratung, 1=Mit Beratung) / +alt1.d(0=Keine Partner, 1=Mit Partner) / +alt1.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) / +alt2.b(0=Results, 1=Action) / +alt2.c(0=Keine Beratung, 1=Mit Beratung) / +alt2.d(0=Keine Partner, 1=Mit Partner) / +alt2.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) +$ \ No newline at end of file diff --git a/Projects/Agora/Designs/efficientdesign.ngd b/Projects/Agora/Designs/efficientdesign.ngd new file mode 100644 index 0000000000000000000000000000000000000000..8e8f4e386ceedc1911625121d1b973e1bdf41832 --- /dev/null +++ b/Projects/Agora/Designs/efficientdesign.ngd @@ -0,0 +1,83 @@ +Design Choice situation alt1.b alt1.c alt1.d alt1.p alt2.b alt2.c alt2.d alt2.p Block +1 1 0 1 1 65 1 0 0 59 2 +1 2 1 0 1 41 0 1 0 77 1 +1 3 1 1 0 41 0 0 1 77 2 +1 4 0 1 0 47 1 0 1 71 2 +1 5 0 1 0 35 1 0 1 83 1 +1 6 0 1 1 71 1 0 0 53 1 +1 7 0 0 1 71 1 1 0 41 1 +1 8 1 0 1 35 0 1 0 83 1 +1 9 1 1 1 53 0 0 0 65 2 +1 10 1 1 0 77 0 0 1 47 1 +1 11 1 1 0 65 0 0 1 47 2 +1 12 0 1 1 59 1 0 0 59 1 +1 13 1 0 0 53 0 1 1 65 2 +1 14 0 0 0 83 1 1 1 35 2 +1 15 1 0 0 83 0 1 1 35 1 +1 16 0 0 1 47 1 1 0 71 2 +1 17 1 0 1 77 0 1 0 41 2 +1 18 0 0 0 59 1 1 1 53 1 +|||||||||| +design +;alts = alt1*, alt2*, alt3 +;rows = 18 +;block = 2 +;eff = (mnl,d) +;rep = 1000 + +;con +;model: +U(alt1) = b1[-1.2] + b2[0.1] * B[0,1] + b3[0.4] * C[0,1] + b4[0.3] * D[0,1] + b5[0.02] * P[35:83:6]/ +U(alt2) = b6[-1.4] + b2 * B + b3 * C + b4 * D + b5 * P + +;formatTitle = 'Scenario <scenarionumber>' +;formatTableDimensions = 3, 6 +;formatTable: +1,1 = '' / +1,2 = 'Results' / +1,3 = 'Beratung' / +1,4 = 'Partner' / +1,5 = 'Kompensation' / +1,6 = 'Choice question&:' / +2,1 = 'alt1' / +2,2 = '<alt1.b>' / +2,3 = '<alt1.c>' / +2,4 = '<alt1.d>' / +2,5 = '<alt1.p>' / +2,6 = '' / +3,1 = 'alt2' / +3,2 = '<alt2.b>' / +3,3 = '<alt2.c>' / +3,4 = '<alt2.d>' / +3,5 = '<alt2.p>' / +3,6 = '' +;formatTableStyle: +1,1 = 'default' / +1,2 = 'headingattribute' / +1,3 = 'headingattribute' / +1,4 = 'headingattribute' / +1,5 = 'headingattribute' / +1,6 = 'headingattribute' / +2,1 = 'heading1' / +2,2 = 'body1' / +2,3 = 'body1' / +2,4 = 'body1' / +2,5 = 'body1' / +2,6 = 'choice1' / +3,1 = 'heading2' / +3,2 = 'body2' / +3,3 = 'body2' / +3,4 = 'body2' / +3,5 = 'body2' / +3,6 = 'choice2' +;formatStyleSheet = Default.css +;formatAttributes: +alt1.b(0=Results, 1=Action) / +alt1.c(0=Keine Beratung, 1=Mit Beratung) / +alt1.d(0=Keine Partner, 1=Mit Partner) / +alt1.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) / +alt2.b(0=Results, 1=Action) / +alt2.c(0=Keine Beratung, 1=Mit Beratung) / +alt2.d(0=Keine Partner, 1=Mit Partner) / +alt2.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) +$ \ No newline at end of file diff --git a/Projects/Agora/Designs/orthodesign.ngd b/Projects/Agora/Designs/orthodesign.ngd new file mode 100644 index 0000000000000000000000000000000000000000..c1a4c8d4566867b578b12cc01da3d97ee59af0e1 --- /dev/null +++ b/Projects/Agora/Designs/orthodesign.ngd @@ -0,0 +1,102 @@ +Design Choice situation alt1.b alt1.c alt1.d alt1.p alt2.b alt2.c alt2.d alt2.p Block +1 1 0 0 0 35 1 0 0 41 2 +1 2 0 0 0 35 0 1 1 41 2 +1 3 1 1 1 35 1 1 0 53 4 +1 4 1 1 1 35 0 1 0 47 1 +1 5 1 0 0 41 1 0 0 59 3 +1 6 1 0 0 41 0 0 0 35 4 +1 7 0 1 1 41 0 1 0 83 4 +1 8 0 1 1 41 1 0 1 59 2 +1 9 0 1 0 47 1 0 0 77 1 +1 10 1 1 0 47 0 0 1 77 2 +1 11 1 0 1 47 0 0 1 53 3 +1 12 0 0 1 47 0 1 1 41 2 +1 13 0 1 0 53 0 1 1 71 3 +1 14 1 1 0 53 0 1 1 59 3 +1 15 0 0 1 53 1 0 0 41 3 +1 16 1 0 1 53 0 0 0 65 1 +1 17 1 0 0 59 1 1 0 47 1 +1 18 0 1 0 59 1 0 0 71 4 +1 19 0 1 1 59 1 1 1 65 2 +1 20 1 0 1 59 0 0 1 47 1 +1 21 0 0 0 65 1 1 1 77 4 +1 22 1 1 0 65 1 1 1 35 4 +1 23 1 1 1 65 0 1 0 77 3 +1 24 0 0 1 65 0 0 0 35 1 +1 25 1 0 0 71 0 0 1 65 2 +1 26 1 1 0 71 1 1 0 65 1 +1 27 0 1 1 71 0 0 0 83 3 +1 28 0 0 1 71 1 0 1 47 3 +1 29 1 0 0 77 1 0 1 53 4 +1 30 0 1 0 77 1 1 1 83 1 +1 31 1 1 1 77 1 0 1 83 1 +1 32 0 0 1 77 0 1 0 53 4 +1 33 0 0 0 83 0 1 0 59 2 +1 34 0 1 0 83 1 1 1 35 2 +1 35 1 1 1 83 0 0 1 71 4 +1 36 1 0 1 83 1 1 0 71 3 +|||||||||| +design +;alts = alt1*, alt2*, alt3 +;rows = 36 +;block = 4 +;orth = seq + + +;con +;model: +U(alt1) = b1 + b2 * B[0,1] + b3 * C[0,1] + b4 * D[0,1] + b5 * P[35:83:6]/ +U(alt2) = b6[-1.4] + b2 * B + b3 * C + b4 * D + b5 * P + + +;formatTitle = 'Scenario <scenarionumber>' +;formatTableDimensions = 3, 6 +;formatTable: +1,1 = '' / +1,2 = 'Results' / +1,3 = 'Beratung' / +1,4 = 'Partner' / +1,5 = 'Kompensation' / +1,6 = 'Choice question&:' / +2,1 = 'alt1' / +2,2 = '<alt1.b>' / +2,3 = '<alt1.c>' / +2,4 = '<alt1.d>' / +2,5 = '<alt1.p>' / +2,6 = '' / +3,1 = 'alt2' / +3,2 = '<alt2.b>' / +3,3 = '<alt2.c>' / +3,4 = '<alt2.d>' / +3,5 = '<alt2.p>' / +3,6 = '' +;formatTableStyle: +1,1 = 'default' / +1,2 = 'headingattribute' / +1,3 = 'headingattribute' / +1,4 = 'headingattribute' / +1,5 = 'headingattribute' / +1,6 = 'headingattribute' / +2,1 = 'heading1' / +2,2 = 'body1' / +2,3 = 'body1' / +2,4 = 'body1' / +2,5 = 'body1' / +2,6 = 'choice1' / +3,1 = 'heading2' / +3,2 = 'body2' / +3,3 = 'body2' / +3,4 = 'body2' / +3,5 = 'body2' / +3,6 = 'choice2' +;formatStyleSheet = Default.css +;formatAttributes: +alt1.b(0=Results, 1=Action) / +alt1.c(0=Keine Beratung, 1=Mit Beratung) / +alt1.d(0=Keine Partner, 1=Mit Partner) / +alt1.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) / +alt2.b(0=Results, 1=Action) / +alt2.c(0=Keine Beratung, 1=Mit Beratung) / +alt2.d(0=Keine Partner, 1=Mit Partner) / +alt2.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) +$ \ No newline at end of file diff --git a/Projects/Agora/Designs/verybaddesign.ngd b/Projects/Agora/Designs/verybaddesign.ngd new file mode 100644 index 0000000000000000000000000000000000000000..dcaa6c0a98ffa7a4abd4b7deb47fe20209167a1e --- /dev/null +++ b/Projects/Agora/Designs/verybaddesign.ngd @@ -0,0 +1,83 @@ +Design Choice situation alt1.b alt1.c alt1.d alt1.p alt2.b alt2.c alt2.d alt2.p Block +1 1 0 1 1 53 0 0 0 65 2 +1 2 1 1 0 77 1 0 1 47 2 +1 3 0 1 0 71 0 0 1 41 1 +1 4 1 1 1 59 1 0 0 65 1 +1 5 0 0 0 65 1 1 1 59 2 +1 6 0 0 1 53 0 1 0 47 2 +1 7 0 0 1 47 1 1 0 71 2 +1 8 1 1 0 83 0 1 1 35 1 +1 9 0 0 1 47 1 0 0 53 1 +1 10 1 1 0 35 0 1 1 83 2 +1 11 0 1 0 65 1 1 1 59 1 +1 12 0 0 0 59 1 0 1 53 1 +1 13 1 1 0 77 1 0 1 41 2 +1 14 1 1 1 35 0 1 0 77 1 +1 15 0 0 1 41 1 1 0 71 1 +1 16 1 0 1 71 0 0 0 77 1 +1 17 1 0 1 83 0 1 0 35 2 +1 18 1 0 0 41 0 0 1 83 2 +|||||||||| +design +;alts = alt1*, alt2*, alt3 +;rows = 18 +;block = 2 +;eff = (mnl,d) +;rep = 1000 + +;model: +U(alt1) = b1[-10] + b2[9] * B[0,1] + b3[4] * C[0,1] + b4[0.3] * D[0,1] + b5[0.02] * P[35:83:6]/ +U(alt2) = b6[-1.4] + b2 * B + b3 * C + b4 * D + b5 * P + + +;formatTitle = 'Scenario <scenarionumber>' +;formatTableDimensions = 3, 6 +;formatTable: +1,1 = '' / +1,2 = 'Results' / +1,3 = 'Beratung' / +1,4 = 'Partner' / +1,5 = 'Kompensation' / +1,6 = 'Choice question&:' / +2,1 = 'alt1' / +2,2 = '<alt1.b>' / +2,3 = '<alt1.c>' / +2,4 = '<alt1.d>' / +2,5 = '<alt1.p>' / +2,6 = '' / +3,1 = 'alt2' / +3,2 = '<alt2.b>' / +3,3 = '<alt2.c>' / +3,4 = '<alt2.d>' / +3,5 = '<alt2.p>' / +3,6 = '' +;formatTableStyle: +1,1 = 'default' / +1,2 = 'headingattribute' / +1,3 = 'headingattribute' / +1,4 = 'headingattribute' / +1,5 = 'headingattribute' / +1,6 = 'headingattribute' / +2,1 = 'heading1' / +2,2 = 'body1' / +2,3 = 'body1' / +2,4 = 'body1' / +2,5 = 'body1' / +2,6 = 'choice1' / +3,1 = 'heading2' / +3,2 = 'body2' / +3,3 = 'body2' / +3,4 = 'body2' / +3,5 = 'body2' / +3,6 = 'choice2' +;formatStyleSheet = Default.css +;formatAttributes: +alt1.b(0=Results, 1=Action) / +alt1.c(0=Keine Beratung, 1=Mit Beratung) / +alt1.d(0=Keine Partner, 1=Mit Partner) / +alt1.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) / +alt2.b(0=Results, 1=Action) / +alt2.c(0=Keine Beratung, 1=Mit Beratung) / +alt2.d(0=Keine Partner, 1=Mit Partner) / +alt2.p(35=#0, 41=#0, 47=#0, 53=#0, 59=#0, 65=#0, 71=#0, 77=#0, 83=#0) +$ \ No newline at end of file diff --git a/Projects/Agora/parameters_agora.R b/Projects/Agora/parameters_agora.R new file mode 100644 index 0000000000000000000000000000000000000000..dc5ff75509057e3f92532e972e1319781c746c35 --- /dev/null +++ b/Projects/Agora/parameters_agora.R @@ -0,0 +1,29 @@ + + +designpath<- "Projects/Agora/Designs/" + +resps =360 # number of respondents +nosim=1000 # number of simulations to run (about 500 is minimum) + +#betacoefficients should not include "-" +#basc = -1.2 +#basc2 = -1.4 +#baction = 0.1 +#badvisory = 0.4 +#bpartner = 0.3 +#bcomp = 0.02 + +basc = -2.2 +basc2 = -2.7 +baction = -0.15 +badvisory = 0.26 +bpartner = -0.09 +bcomp = 0.004 + + + +#place your utility functions here +u<-list( + v1=V.1 ~ basc + baction*alt1.b + badvisory * alt1.c + bpartner * alt1.d + bcomp * alt1.p , #Utility of alternative 1 + v2=V.2 ~ basc2 + baction*alt2.b + badvisory * alt2.c + bpartner * alt2.d + bcomp * alt2.p , #Utility of alternative 2 + v3=V.3 ~ 0) diff --git a/Projects/ValuGaps/parameters_valugaps.R b/Projects/ValuGaps/parameters_valugaps.R index 0a48b33ec9a91d10da73d132b6a0b1fc19779223..44ac11fe4bd92dcc83f2253936737d20bad25bcd 100644 --- a/Projects/ValuGaps/parameters_valugaps.R +++ b/Projects/ValuGaps/parameters_valugaps.R @@ -1,132 +1,132 @@ - -library(raster) -library(terra) -library(sf) -library("rnaturalearth") -library("rnaturalearthdata") -library("exactextractr") - - -designpath<- "Projects/ValuGaps/Designs/" - - - - - -hnv <- rast("Projects/ValuGaps/data/gis/hnv_germany.tif") - -# Load in HNV raster data (preprocessed) - - -# Load BFN protected areas data - -protected_areas <- readRDS("Projects/ValuGaps/data/gis/protected_bfn_raster.rds") - -############################################################################################## -# Load in Protected areas data (preprocessed) (protected planet data, comment out if use bfn data) - -# protected_areas_all <- readRDS("Projects/ValuGaps/data/gis/germany_protected.rds") -# levels(protected_areas_all) -# -# categories_to_drop <- c(1,3, 4, 6, 8, 9, 11) # define categories that should not be included in protected areas -# # keeps nationalparks, nature conservation areas and UNESCO biosphere reserve -# -# protected_areas <- protected_areas_all -# protected_areas[protected_areas %in% categories_to_drop] <-NA # Make binary categories -# -# names(protected_areas) <- "value" -############################################################################################## - - -# Code protected areas as zero/one -protected_areas <- ifel(is.na(protected_areas), 0, 1) - - - -# Load in shapefile of germany -germany_sf <- read_sf("Projects/ValuGaps/data/gis/WDPA_WDOECM_Feb2023_Public_DEU_shp/gadm41_DEU_shp", "gadm41_DEU_0") # no county borders -germany_sf_county <- read_sf("Projects/ValuGaps/data/gis/WDPA_WDOECM_Feb2023_Public_DEU_shp/gadm41_DEU_shp", "gadm41_DEU_2") - -germany_geo <- st_transform(germany_sf$geometry, crs=crs(protected_areas)) # transform to raster crs -germany_geo_county <- st_transform(germany_sf_county$geometry, crs=crs(protected_areas)) - - -#### Read in CORINE Land cover data #### - -corine <- rast("Projects/ValuGaps/data/gis/corine_raster_2018/DATA/U2018_CLC2018_V2020_20u1.tif") -germany_geo_c <- st_transform(germany_sf_county$geometry, crs=crs(corine)) # used to crop corine data to Germany -corine <- crop(corine, germany_geo_c) -corine <- mask(corine, vect(germany_geo_c)) -levels(corine) - -hnv_categories <- c(12, 14:22, 26:29, 32, 35:37) # see p.37 HNV EUROPE DATA Documentation -corine_hnv <- corine -corine_hnv[!(corine_hnv %in% hnv_categories)] <-NA # Make binary categories -corine_hnv <- ifel(is.na(corine_hnv), 0, 1) -corine_hnv <- mask(corine_hnv, vect(germany_geo_c)) -corine_hnv <- mask(corine_hnv, hnv) - - -#### Protected areas CORINE -protected_area_categories <- c(10, 12:41) # remove artificial areas except UGS and remove marine waters -corine_pa <- corine -corine_pa[!(corine_pa %in% protected_area_categories)] <-NA # Make binary categories -corine_pa <- ifel(is.na(corine_pa), 0, 1) -corine_pa <- mask(corine_pa, vect(germany_geo_c)) - -protected_areas <- mask(protected_areas, vect(germany_geo_c)) -#### - - - -#### Define simulation parameters #### - -resps = 96 # number of respondents -nosim=3 # number of simulations to run (about 500 is minimum) -#buffer_dist <- 15000 - -buffer_dist_ls <- list(10000, 15000, 25000, 50000) # define radius for the respondents in meter - - -# betacoefficients should not include "-" -basc = 0.5 -bb = 1.2 -bb2 = -0.016 -bc= 1.4 -bc2 = -0.0175 -bp=-0.03 - -mani1 = expr(left_join(final_set, by="ID")) - -manipulations = list( -#expr(across(c("HNV_on_corine", "Protected_on_corine"), ~replace_na(.,0)) ), -alt1.protected = expr(alt1.b+Protected_on_corine*100), -alt2.protected = expr(alt2.b+Protected_on_corine*100), -alt3.protected = expr(Protected_on_corine*100), -alt1.HNV = expr(alt1.b+HNV_on_corine*100), -alt2.HNV = expr(alt2.b+HNV_on_corine*100), -alt3.HNV = expr(HNV_on_corine*100), -expr(across(.cols=matches("HNV|protected"),.fns = ~.x^2, .names = "{.col}{'sq'}" ) ) - - -) - -#place your utility functions here - -u<-list( - v1 =V.1~ basc + bb * alt1.protected + bb2 * alt1.protectedsq + bc * alt1.HNV + bc2 * alt1.HNVsq + bp * alt1.p , - v2 =V.2~ basc + bb * alt2.protected + bb2 * alt2.protectedsq + bc * alt2.HNV + bc2 * alt2.HNVsq + bp * alt2.p , - v3 =V.3~ bb * alt3.protected + bb2 * alt3.protectedsq + bc * alt3.HNV + bc2 * alt3.HNVsq ) - -# u<-list( -# v1 =V.1~ basc + bb*alt1.b+ bc * alt1.c + bp * alt1.p , -# v2 =V.2~ basc + bb*alt2.b+ bc * alt2.c + bp * alt2.p , -# v3 =V.3~ 0) - - -## this function will be called before the data is simulated -sou_gis <- function() { - - source("Projects/ValuGaps/code/GIS_data.R") - -} + +library(raster) +library(terra) +library(sf) +library("rnaturalearth") +library("rnaturalearthdata") +library("exactextractr") + + +designpath<- "Projects/ValuGaps/Designs/" + + + + + +hnv <- rast("Projects/ValuGaps/data/gis/hnv_germany.tif") + +# Load in HNV raster data (preprocessed) + + +# Load BFN protected areas data + +protected_areas <- readRDS("Projects/ValuGaps/data/gis/protected_bfn_raster.rds") + +############################################################################################## +# Load in Protected areas data (preprocessed) (protected planet data, comment out if use bfn data) + +# protected_areas_all <- readRDS("Projects/ValuGaps/data/gis/germany_protected.rds") +# levels(protected_areas_all) +# +# categories_to_drop <- c(1,3, 4, 6, 8, 9, 11) # define categories that should not be included in protected areas +# # keeps nationalparks, nature conservation areas and UNESCO biosphere reserve +# +# protected_areas <- protected_areas_all +# protected_areas[protected_areas %in% categories_to_drop] <-NA # Make binary categories +# +# names(protected_areas) <- "value" +############################################################################################## + + +# Code protected areas as zero/one +protected_areas <- ifel(is.na(protected_areas), 0, 1) + + + +# Load in shapefile of germany +germany_sf <- read_sf("Projects/ValuGaps/data/gis/WDPA_WDOECM_Feb2023_Public_DEU_shp/gadm41_DEU_shp", "gadm41_DEU_0") # no county borders +germany_sf_county <- read_sf("Projects/ValuGaps/data/gis/WDPA_WDOECM_Feb2023_Public_DEU_shp/gadm41_DEU_shp", "gadm41_DEU_2") + +germany_geo <- st_transform(germany_sf$geometry, crs=crs(protected_areas)) # transform to raster crs +germany_geo_county <- st_transform(germany_sf_county$geometry, crs=crs(protected_areas)) + + +#### Read in CORINE Land cover data #### + +corine <- rast("Projects/ValuGaps/data/gis/corine_raster_2018/DATA/U2018_CLC2018_V2020_20u1.tif") +germany_geo_c <- st_transform(germany_sf_county$geometry, crs=crs(corine)) # used to crop corine data to Germany +corine <- crop(corine, germany_geo_c) +corine <- mask(corine, vect(germany_geo_c)) +levels(corine) + +hnv_categories <- c(12, 14:22, 26:29, 32, 35:37) # see p.37 HNV EUROPE DATA Documentation +corine_hnv <- corine +corine_hnv[!(corine_hnv %in% hnv_categories)] <-NA # Make binary categories +corine_hnv <- ifel(is.na(corine_hnv), 0, 1) +corine_hnv <- mask(corine_hnv, vect(germany_geo_c)) +corine_hnv <- mask(corine_hnv, hnv) + + +#### Protected areas CORINE +protected_area_categories <- c(10, 12:41) # remove artificial areas except UGS and remove marine waters +corine_pa <- corine +corine_pa[!(corine_pa %in% protected_area_categories)] <-NA # Make binary categories +corine_pa <- ifel(is.na(corine_pa), 0, 1) +corine_pa <- mask(corine_pa, vect(germany_geo_c)) + +protected_areas <- mask(protected_areas, vect(germany_geo_c)) +#### + + + +#### Define simulation parameters #### + +resps = 96 # number of respondents +nosim=100 # number of simulations to run (about 500 is minimum) +#buffer_dist <- 15000 + +buffer_dist_ls <- list(10000, 15000, 25000, 50000) # define radius for the respondents in meter + + +# betacoefficients should not include "-" +basc = 0.5 +bb = 1.2 +bb2 = -0.016 +bc= 1.4 +bc2 = -0.0175 +bp=-0.03 + +mani1 = expr(left_join(final_set, by="ID")) + +manipulations = list( +#expr(across(c("HNV_on_corine", "Protected_on_corine"), ~replace_na(.,0)) ), +alt1.protected = expr(alt1.b+Protected_on_corine*100), +alt2.protected = expr(alt2.b+Protected_on_corine*100), +alt3.protected = expr(Protected_on_corine*100), +alt1.HNV = expr(alt1.b+HNV_on_corine*100), +alt2.HNV = expr(alt2.b+HNV_on_corine*100), +alt3.HNV = expr(HNV_on_corine*100), +expr(across(.cols=matches("HNV|protected"),.fns = ~.x^2, .names = "{.col}{'sq'}" ) ) + + +) + +#place your utility functions here + +u<-list( + v1 =V.1~ basc + bb * alt1.protected + bb2 * alt1.protectedsq + bc * alt1.HNV + bc2 * alt1.HNVsq + bp * alt1.p , + v2 =V.2~ basc + bb * alt2.protected + bb2 * alt2.protectedsq + bc * alt2.HNV + bc2 * alt2.HNVsq + bp * alt2.p , + v3 =V.3~ bb * alt3.protected + bb2 * alt3.protectedsq + bc * alt3.HNV + bc2 * alt3.HNVsq ) + +# u<-list( +# v1 =V.1~ basc + bb*alt1.b+ bc * alt1.c + bp * alt1.p , +# v2 =V.2~ basc + bb*alt2.b+ bc * alt2.c + bp * alt2.p , +# v3 =V.3~ 0) + + +## this function will be called before the data is simulated +sou_gis <- function() { + + source("Projects/ValuGaps/code/GIS_data.R") + +} diff --git a/generatemd.R b/generatemd.R index f764c58292cdf13d48db7d529d4d99a89cf62f8c..1381851f8b7a0efea6bad2ed36073cf08e379a13 100644 --- a/generatemd.R +++ b/generatemd.R @@ -1,12 +1,13 @@ rm(list=ls()) -# file <- "Projects/SE_AGRI/parameters_SE Design-Agri.R" -file <- "Projects/SVAB/SVAB_simulation_parameters_test2_type1.R" +#file <- "Projects/ValuGaps/parameters_valugaps.R" + file <- "Projects/Agora/parameters_agora.R" + rmarkdown::render("simulation_output.rmd", output_file = paste0(stringr::str_remove_all(file, - "parameters_|.R$"),".html"), + "parameters_|.R$"),"reecap.html"), params = list(file=file) )