Public
Edited
Jul 11, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof asymptote_upper2 = Inputs.range([peak, 1], {label: "Peakedness 2"})
Insert cell
Insert cell
Insert cell
data = {
const arr = new Array(T);
const arr2 = new Array(T);
/*
for(let t = 0; t < T; t++) {
arr[t] = {
x: t,
//y: asymptote * logistic(t, rate, timing) * observations[0].y / (asymptote * logistic(observations[0].x, rate, timing))
y: asymptote * logistic(t, rate, timing)
};
}
*/

const tstar = observations[0].x;
arr[tstar] = { x: tstar, y: observations[0].y, y2: observations[0].y };
for(let t = tstar - 1; t >= 0; t--) {
arr[t] = {
x: t,
y: arr[t + 1].y - logistic_rate(arr[t + 1].y, rate, asymptote_lower, asymptote_upper)
};
arr[t].y2 = arr[t].y;
}
for(let t = tstar + 1; t < T; t++) {
arr[t] = {
x: t,
y: arr[t - 1].y - logistic_rate(arr[t - 1].y, rate2, asymptote_lower2, asymptote_upper)
};
arr[t].y2 = arr[t - 1].y2 + logistic_rate(arr[t - 1].y2, rate, asymptote_lower, asymptote_upper);
}
return arr;
}
Insert cell
logit = (x) => Math.log(x) - Math.log(1 - x)
Insert cell
logit(0.9)
Insert cell
inv_logit = (x) => Math.exp(x) / (Math.exp(x) + 1)
Insert cell
T = 50
Insert cell
logistic = (t, rate, timing) => 1 / (1 + Math.exp(-rate * (t - timing)))
Insert cell
logistic_rate = (y, rate, asymptote_lower, asymptote_upper) => rate * (y - asymptote_lower) * (1 - (y - asymptote_lower) / (asymptote_upper - asymptote_lower))

//asymptote_upper * inv_logit(logit((y - asymptote_lower) / (asymptote_upper - asymptote_lower)) + rate)
Insert cell
//
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more