annotate rDiff/src/locfit/m/invlink.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 y0 = invlink(y,fali)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
2 % inverse link function for locfit.
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
3 % y is a vector of raw fitted values.
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
4 % fali is the integer [family link] vector from locfit.
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
5 % output is the inv. link.
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
6
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
7 link = fali(2);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
8
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
9 switch(link)
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
10 case 3 % identity
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
11 y0 = y;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
12 case 4 % log
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
13 y0 = exp(y);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
14 case 5 % logit - should invert carefully!
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
15 y0 = 1 - 1./(1+exp(y));
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
16 case 6 % inverse
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
17 y0 = 1/y;
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
18 case 7 % sqrt
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
19 y0 = y*abs(y);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
20 case 8 % arcsin
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
21 y0 = sin(y)*sin(y);
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
22 otherwise
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
23 disp('invlink: Unknown link function');
0f80a5141704 version 0.3 uploaded
vipints
parents:
diff changeset
24 end;