\[I = I(Y, i) = b_0 + b_1Y - b_2i \qquad \text{mit } b_0 \geq 0, b_1 \geq 0 \text{ und } b_2 \geq 0\]
arr_Y = Array.from(Array(100).keys())
consumption = arr_Y.map(x => b0 + b1 * x + b2 * i)
data_sim = arr_Y.map(function(x){
return ({ Y: arr_Y[x],
I: consumption[x]
})
})
Plot.plot({
y: {domain:[0, 100]},
x: {domain:[0, 100]},
grid: true,
width: "1000",
height: "600",
marks:[
Plot.line(data_sim,{x: "Y", y: "I", stroke: "black"}),
Plot.link([Y], {x1: (k) => k, x2: (k) => k, y1: 0, y2: (k) => b0 + b1 * k + b2 * i, stroke: "red"}),
Plot.link([Y], {x1: 0, x2: (k) => k, y1: (k) => b0 + b1 * k + b2 * i, y2: (k) => b0 + b1 * k + b2 * i, stroke: "red"}),
Plot.text([Y], {x: (k) => k + 4, y: 2, text: (k) => "Y = " + Y}),
Plot.text([Y], {x: 4, y: (k) => b0 + b1 * k + b2 * i + 4, text: (k) => "I = " + Math.round(b0 + b1 * k + b2 * i)}),
]
})