There were at least 121 reported Covid infections among SU students between October 8 and October 26 of 2020. The following are the cumulative counts of people recovered, day by day, starting with October 9.
R = [1 1 1 5 8 10 27 44 62 93 101 110 112 115 116 117 118 120]';
Fit a logistic function to these proportion of the total “population” of 121 that recovered on each day.
Solution.
We need to compute proportions
y = R/121 and transform them by yt = log(y./(1-y)). Then the usual linear regression is applied.
x = (1:numel(R))'; y = R/121; yt = log(y./(1-y)); X = x.^(0:1); beta = X\yt; f = @(x) 1 ./ (1 + exp(-(x.^(0:1))*beta)); t = linspace(min(x), max(x), 1000)'; plot(t, f(t), 'b', x, y, 'r*')
Here the logistic function is written as \(1/(1+\exp(-\beta_1 - \beta_2 x))\) with parameters \(\beta_1, \beta_2\) contained in the vector
beta.
