7017
|
1 ## Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2005, 2006, 2007 |
|
2 ## Kurt Hornik |
3426
|
3 ## |
3922
|
4 ## This file is part of Octave. |
|
5 ## |
|
6 ## Octave is free software; you can redistribute it and/or modify it |
|
7 ## under the terms of the GNU General Public License as published by |
7016
|
8 ## the Free Software Foundation; either version 3 of the License, or (at |
|
9 ## your option) any later version. |
3426
|
10 ## |
3922
|
11 ## Octave is distributed in the hope that it will be useful, but |
3200
|
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3426
|
14 ## General Public License for more details. |
|
15 ## |
3200
|
16 ## You should have received a copy of the GNU General Public License |
7016
|
17 ## along with Octave; see the file COPYING. If not, see |
|
18 ## <http://www.gnu.org/licenses/>. |
3200
|
19 |
3453
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} logit (@var{p}) |
6754
|
22 ## For each component of @var{p}, return the logit of @var{p} defined as |
|
23 ## @iftex |
|
24 ## @tex |
|
25 ## $$ |
|
26 ## {\rm logit}(p) = \log\Big({p \over 1-p}\Big) |
|
27 ## $$ |
|
28 ## @end tex |
6773
|
29 ## @end iftex |
6754
|
30 ## @ifnottex |
|
31 ## @example |
|
32 ## logit(@var{p}) = log (@var{p} / (1-@var{p})) |
|
33 ## @end example |
|
34 ## @end ifnottex |
3453
|
35 ## @end deftypefn |
3426
|
36 |
5428
|
37 ## Author: KH <Kurt.Hornik@wu-wien.ac.at> |
3456
|
38 ## Description: Logit transformation |
3200
|
39 |
|
40 function y = logit (p) |
3426
|
41 |
3200
|
42 if (nargin == 1) |
|
43 y = logistic_inv (p); |
|
44 else |
6046
|
45 print_usage (); |
3200
|
46 endif |
|
47 |
6754
|
48 endfunction |