Keynesianische Konsumfunktion
\[C(Y_V) = c_0 + c_1 Y_V \qquad \text{mit } c_0 > 0 \text{ und } 0 < c_1 < 1\]
arr_Y = Array.from(Array(100).keys())
consumption = arr_Y.map(x => c0 + c1 * x)
data_sim = arr_Y.map(function(x){
return ({ Y: arr_Y[x],
C: consumption[x]
})
})
Plot.plot({
y: {domain:[0, 100]},
x: {domain:[0, 100]},
width: "1000",
height: "600",
grid: true,
marks:[
Plot.line(data_sim,{x: "Y", y: "C", stroke: "black"}),
Plot.link([Yv], {x1: (k) => k, x2: (k) => k, y1: 0, y2: (k) => c0 + c1*k, stroke: "red"}),
Plot.link([Yv], {x1: 0, x2: (k) => k, y1: (k) => c0 + c1*k, y2: (k) => c0 + c1*k, stroke: "red"}),
Plot.link([Yv], {x1: 0, x2: (k) => k, y1: 0 , y2: (k) => c0 + c1*k, stroke: "blue"}),
Plot.text([Yv], {x: (k) => k + 4, y: 2, text: (k) => "Yv = " + Yv}),
Plot.text([Yv], {x: 4, y: (k) => c0 + c1*k + 4, text: (k) => "C = " + Math.round(c0 + (c1*k))}),
Plot.text([Yv], {x: (k) => (k/2)+10, y: (k) => (c0 + c1*k)/2 , text: (k) => "C/Yv = " + Math.round(100*(c0 + c1*k)/Yv)/100})
]
})