annotate rDiff/src/locfit/m/backtr.m @ 3:29a698dc5c7e default tip

Merge multiple heads.
author Dave Bouvier <dave@bx.psu.edu>
date Mon, 27 Jan 2014 14:15:36 -0500
parents 0f80a5141704
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
1 function z=backtr(y,fit)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
2 %
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
3 % Inverse-link transformation of y.
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
4
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
5 fali = fit.fit_points.family_link;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
6 link = fali(2);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
7 switch link
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
8 case 3
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
9 z=y;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
10 case 4
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
11 z=exp(y);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
12 case 5
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
13 z = y;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
14 i = find(y<=0);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
15 if (length(i)>0)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
16 z(i) = exp(y(i))./(1+exp(y(i)));
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
17 end;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
18 i = find(y>0);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
19 if (length(i)>0)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
20 z(i) = 1./(1+exp(-y(i)));
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
21 end;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
22 case 6
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
23 z=1./y;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
24 case 7
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
25 z=y.*abs(y);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
26 case 8
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
27 z=sin(y).^2;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
28 otherwise
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
29 disp('Backtr: invalid link');
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
30 z=y;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
31 end;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
32
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
33 return;