logifit
Estimate mean and confidence intervals for the logistic distribution.
mu0 = logifit (x)
returns the maximum likelihood
estimates of the parameters of the logistic distribution given the data in
x. paramhat(1)
is the scale parameter, mu, and
paramhat(2)
is the shape parameter, s.
[paramhat, paramci] = logifit (x)
returns the 95%
confidence intervals for the parameter estimates.
[…] = logifit (x, alpha)
also returns the
100 * (1 - alpha)
percent confidence intervals for the
parameter estimates. By default, the optional argument alpha is
0.05 corresponding to 95% confidence intervals. Pass in []
for
alpha to use the default values.
[…] = logifit (x, alpha, censor)
accepts a
boolean vector, censor, of the same size as x with 1
s for
observations that are right-censored and 0
s for observations that are
observed exactly. By default, or if left empty,
censor = zeros (size (x))
.
[…] = logifit (x, alpha, censor, freq)
accepts a frequency vector, freq, of the same size as x.
freq typically contains integer frequencies for the corresponding
elements in x, but it can contain any non-integer non-negative values.
By default, or if left empty, freq = ones (size (x))
.
[…] = logifit (…, options)
specifies control
parameters for the iterative algorithm used to compute ML estimates with the
fminsearch
function. options is a structure with the following
fields and their default values:
options.Display = "off"
options.MaxFunEvals = 400
options.MaxIter = 200
options.TolX = 1e-6
Further information about the logistic distribution can be found at https://en.wikipedia.org/wiki/Logistic_distribution
See also: logicdf, logiinv, logipdf, logirnd, logilike, logistat
Source Code: logifit
## Sample 3 populations from different logistic distibutions rand ("seed", 5) # for reproducibility r1 = logirnd (2, 1, 2000, 1); rand ("seed", 2) # for reproducibility r2 = logirnd (5, 2, 2000, 1); rand ("seed", 7) # for reproducibility r3 = logirnd (9, 4, 2000, 1); r = [r1, r2, r3]; ## Plot them normalized and fix their colors hist (r, [-6:20], 1); h = findobj (gca, "Type", "patch"); set (h(1), "facecolor", "c"); set (h(2), "facecolor", "g"); set (h(3), "facecolor", "r"); ylim ([0, 0.3]); xlim ([-5, 20]); hold on ## Estimate their MU and LAMBDA parameters mu_sA = logifit (r(:,1)); mu_sB = logifit (r(:,2)); mu_sC = logifit (r(:,3)); ## Plot their estimated PDFs x = [-5:0.5:20]; y = logipdf (x, mu_sA(1), mu_sA(2)); plot (x, y, "-pr"); y = logipdf (x, mu_sB(1), mu_sB(2)); plot (x, y, "-sg"); y = logipdf (x, mu_sC(1), mu_sC(2)); plot (x, y, "-^c"); hold off legend ({"Normalized HIST of sample 1 with μ=1 and s=0.5", ... "Normalized HIST of sample 2 with μ=2 and s=0.3", ... "Normalized HIST of sample 3 with μ=4 and s=0.5", ... sprintf("PDF for sample 1 with estimated μ=%0.2f and s=%0.2f", ... mu_sA(1), mu_sA(2)), ... sprintf("PDF for sample 2 with estimated μ=%0.2f and s=%0.2f", ... mu_sB(1), mu_sB(2)), ... sprintf("PDF for sample 3 with estimated μ=%0.2f and s=%0.2f", ... mu_sC(1), mu_sC(2))}) title ("Three population samples from different logistic distibutions") hold off |