Student-t Distribution
plt_t = Plot.plot({
style: {fontSize: "16px"},
color: {
legend: true,
style: {fontSize: "16px"}
},
x: {
label: "x",
axis: true
},
y: {
axis: false,
domain: [0,0.4]
},
marks: [
Plot.ruleY([0]),
Plot.line(data_t, {x: "x", y: "pdf", stroke : "dist", strokeWidth: 2}),
Plot.areaY(data_t, {filter: d => d.x <= myinputs[1] && d.dist == "normal", x: "x", y: "pdf", fill: "steelblue", opacity: 0.2}),
Plot.areaY(data_t, {filter: d => d.x <= myinputs[1] && d.dist == "student-t", x: "x", y: "pdf", fill: "orange", opacity: 0.2}),
]
})Plot.plot({
caption: html`Zoom in the left tail`,
style: {fontSize: "16px"},
color: {
legend: true,
style: {fontSize: "16px"}
},
x: {
label: "x",
axis: true,
ticks: [-8,-7,-6,-5,-4,-3, myinputs_zoom[1]],
domain: [-8,-3]
},
y: {
axis: true,
domain: [0,0.01]
},
marks: [
Plot.ruleY([0]),
Plot.ruleX([-10]),
Plot.ruleX([myinputs_zoom[1]], {stroke: "gray", strokeOpacity: 0.4}),
Plot.line(data_zoom, {filter: d => d.x <= -3, x: "x", y: "pdf", stroke : "dist", strokeWidth: 2}),
//Plot.areaY(data, {filter: d => d.x <= myinputs[1] && d.dist == "normal", x: "x", y: "pdf", fill: "steelblue", opacity: 0.2}),
//Plot.areaY(data, {filter: d => d.x <= myinputs[1] && d.dist == "student-t", x: "x", y: "pdf", fill: "orange", opacity: 0.2}),
]
})