Last change
on this file since 177 was
37,
checked in by (none), 15 years ago
|
Added original make3d
|
-
Property svn:executable set to
*
|
File size:
645 bytes
|
Line | |
---|
1 | function e = normcdflogit(x)
|
---|
2 | % NORMCDFLOGIT log(normcdf/(1-normcdf))
|
---|
3 | % More accurate than explicitly evaluating log(normcdf/(1-normcdf)), and
|
---|
4 | % retains more precision than normcdfln when x is large.
|
---|
5 |
|
---|
6 | % Written by Tom Minka
|
---|
7 | % (c) Microsoft Corporation. All rights reserved.
|
---|
8 |
|
---|
9 | e = x;
|
---|
10 | small = -7;
|
---|
11 | large = 7;
|
---|
12 | i = find(x >= small & x <= large);
|
---|
13 | if ~isempty(i)
|
---|
14 | e(i) = normcdf(x(i));
|
---|
15 | e(i) = log(e(i)./(1-e(i)));
|
---|
16 | end
|
---|
17 | i = find(x < small);
|
---|
18 | if ~isempty(i)
|
---|
19 | e(i) = normcdfln(x(i));
|
---|
20 | %e(i) = e(i) - log(1-exp(e(i)));
|
---|
21 | end
|
---|
22 | i = find(x > large);
|
---|
23 | if ~isempty(i)
|
---|
24 | e(i) = -normcdfln(-x(i));
|
---|
25 | %e(i) = log(1-exp(-e(i))) + e(i);
|
---|
26 | end
|
---|
Note: See
TracBrowser
for help on using the repository browser.