Mercurial > hg > octave-lyh
annotate scripts/statistics/models/private/logistic_regression_likelihood.m @ 17184:abf384f5d243
maint: Remove unneeded input validation from internal fcns in private/ directories.
* scripts/general/private/__isequal__.m,
scripts/general/private/__splinen__.m,
scripts/image/private/__imwrite__.m,
scripts/image/private/ind2x.m,
scripts/miscellaneous/private/__xzip__.m,
scripts/miscellaneous/private/display_info_file.m,
scripts/pkg/private/describe.m,
scripts/pkg/private/get_forge_pkg.m,
scripts/pkg/private/unload_packages.m,
scripts/plot/private/__actual_axis_position__.m,
scripts/plot/private/__add_datasource__.m,
scripts/plot/private/__clabel__.m,
scripts/plot/private/__errcomm__.m,
scripts/plot/private/__errplot__.m,
scripts/plot/private/__fltk_print__.m,
scripts/plot/private/__gnuplot_get_var__.m,
scripts/plot/private/__go_draw_axes__.m,
scripts/plot/private/__go_draw_figure__.m,
scripts/plot/private/__interp_cube__.m,
scripts/plot/private/__line__.m,
scripts/plot/private/__next_line_color__.m,
scripts/plot/private/__next_line_style__.m,
scripts/plot/private/__plt__.m,
scripts/plot/private/__pltopt__.m,
scripts/signal/private/rectangle_lw.m,
scripts/signal/private/rectangle_sw.m,
scripts/signal/private/triangle_lw.m,
scripts/signal/private/triangle_sw.m,
scripts/sparse/private/__sprand_impl__.m,
scripts/statistics/models/private/logistic_regression_derivatives.m,
scripts/statistics/models/private/logistic_regression_likelihood.m:
Remove unneeded input validation from internal fcns in private/ directories.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 04 Aug 2013 18:13:08 -0700 |
parents | 5d3a684236b0 |
children | 1c89599167a6 |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
12530
diff
changeset
|
1 ## Copyright (C) 1995-2012 Kurt Hornik |
3426 | 2 ## |
3922 | 3 ## This file is part of Octave. |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
3426 | 9 ## |
3922 | 10 ## Octave is distributed in the hope that it will be useful, but |
3191 | 11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
3426 | 13 ## General Public License for more details. |
14 ## | |
3191 | 15 ## You should have received a copy of the GNU General Public License |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
3191 | 18 |
3454 | 19 ## -*- texinfo -*- |
20 ## @deftypefn {Function File} {[@var{g}, @var{g1}, @var{p}, @var{dev}] =} logistic_regression_likelihood (@var{y}, @var{x}, @var{beta}, @var{z}, @var{z1}) | |
12530
d70c99028ba3
Make helper functions for logistic_regression private.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
21 ## Calculate the likelihood for the ordinal logistic regression model. |
d70c99028ba3
Make helper functions for logistic_regression private.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
22 ## Private function called by @code{logistic_regression}. |
d70c99028ba3
Make helper functions for logistic_regression private.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
23 ## @seealso{logistic_regression} |
3454 | 24 ## @end deftypefn |
3426 | 25 |
3456 | 26 ## Author: Gordon K. Smyth <gks@maths.uq.oz.au> |
5428 | 27 ## Adapted-By: KH <Kurt.Hornik@wu-wien.ac.at> |
3456 | 28 ## Description: Likelihood in logistic regression |
3191 | 29 |
3454 | 30 function [g, g1, p, dev] = logistic_regression_likelihood (y, x, beta, z, z1) |
3426 | 31 |
3238 | 32 e = exp ([z, x] * beta); e1 = exp ([z1, x] * beta); |
3191 | 33 g = e ./ (1 + e); g1 = e1 ./ (1 + e1); |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
34 g = max (y == max (y), g); g1 = min (y > min (y), g1); |
3426 | 35 |
3191 | 36 p = g - g1; |
3426 | 37 dev = -2 * sum (log (p)); |
3191 | 38 |
39 endfunction |