Functions | |
if (nargin< 2) x | |
if (mx!=my) error("x and y must have the same number of observations") | |
while (abs(dl'*(d2l\dl)/length(dl)) > tol) iter | |
else | while ((dev-devold)/(dl'*(tb-tbold)) > 0) epsilon |
if (epsilon > 1e+15) error("epsilon too large") | |
disp ("epsilon") | |
disp (epsilon) | |
if (print==2) disp("Iteration") | |
disp (iter) | |
disp ("Deviance") | |
disp (dev) | |
disp ("First derivative") | |
disp (dl') | |
disp ("Eigenvalues of second derivative") | |
disp (eig(d2l)') | |
if (print >=1) printf("\n") | |
printf ("Logistic Regression Results:\n") | |
printf ("\n") | |
printf ("Number of Iterations: %d\n", iter) | |
printf ("Deviance: %f\n", dev) | |
printf ("Parameter Estimates:\n") | |
printf (" Theta S.E.\n") | |
endfor | if (nx > 0) printf(" Beta S.E.\n") |
endfor endif endif | if (nargout==6) if(nx > 0) e |
Variables | |
function [theta, beta, dev, dl, d2l, p] | |
endif = logistic_regression_derivatives (x, z, z1, g, g1, p) | |
endif | x = -x |
tol = 1e-6 | |
incr = 10 | |
decr = 2 | |
ymin = min (y) | |
ymax = max (y) | |
yrange = ymax - ymin | |
z = (y * ones (1, yrange)) == ((y * 0 + 1) * (ymin : (ymax - 1))) | |
z1 = (y * ones (1, yrange)) == ((y * 0 + 1) * ((ymin + 1) : ymax)) | |
theta = log (g ./ (1 - g)) | |
tb = [theta | |
beta = tb ((nz + 1) : (nz + nx), 1) | |
epsilon = logistic_regression_likelihood (y, x, tb, z, z1) logistic_regression_derivatives (x, z, z1, g, g1, p) std (vec (d2l)) / 1000 | |
iter = 0 | |
tbold = tb | |
devold = dev | |
se = sqrt (diag (inv (-d2l))) | |
for | i |
else | e = (y * 0 + 1) * theta' |
disp | ( | eig(d2l)' | ) |
disp | ( | "Eigenvalues of second derivative" | ) |
disp | ( | dl' | ) |
disp | ( | "First derivative" | ) |
disp | ( | dev | ) |
disp | ( | "Deviance" | ) |
disp | ( | iter | ) |
disp | ( | epsilon | ) |
disp | ( | "epsilon" | ) |
if | ( | print >= | 1 | ) |
if | ( | = =2 |
) |
if | ( | epsilon | , | |
1e+ | 15 | |||
) |
if | ( | mx! | = my |
) |
if | ( | ) |
printf | ( | " Theta S.E.\n" | ) |
printf | ( | "Parameter Estimates:\n" | ) |
printf | ( | "Deviance: %f\n" | , | |
dev | ||||
) |
printf | ( | "Number of Iterations: %d\n" | , | |
iter | ||||
) |
printf | ( | "\n" | ) |
printf | ( | "Logistic Regression Results:\n" | ) |
decr = 2 |
epsilon = logistic_regression_likelihood (y, x, tb, z, z1) logistic_regression_derivatives (x, z, z1, g, g1, p) std (vec (d2l)) / 1000 |
incr = 10 |
iter = 0 |
tol = 1e-6 |
endif x = -x |
ymax = max (y) |
ymin = min (y) |