Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.

Ticket #11236: render.R

File render.R, 9.1 KB (added by rleigh, 10 years ago)

Test normalised transfer functions

Line 
1lintest <- function(x, k) { x }
2exptest <- function(x, k) { (exp(x^k) - 1) / (exp(1) - 1) }
3logtest <- function(x, k) { log((x * (exp(k) - 1)) + 1) / k }
4#logtest <- function(x, k) { - log(exp(x) -x + 1)^(1/k) }
5polytest <- function(x, k) { x^k }
6gammatest <- function(x, k) { x^k }
7logistic <- function(x, k) { 1 / (1 + exp(-((x-0.5)*k))) }
8logistictest <- function(x, k) { ((logistic(x, k) - 0.5) / (1 - (logistic(0, k) *2))) + 0.5 }
9invlogistic <- function(x, k) { (log ( - (x) / ((x)-1))/k) + 0.5 }
10invlogistictest <- function(x, k) { invlogistic(((x-0.5) * (1 - (logistic(0, k) *2))) + 0.5, k) }
11
12fulllogistic <- function(x, k) { (((1 / (1 + exp(-((x-0.5)*k)))) - 0.5) / (1 - ((1 / (1 + exp(-((-0.5)*k)))) *2))) + 0.5 }
13fullinvlogistic <- function(x, k) { (log ( - (((x-0.5) * (1 - ((1 / (1 + exp(-(-0.5*k)))) *2))) + 0.5) / ((((x-0.5) * (1 - ((1 / (1 + exp(-(-0.5*k)))) *2))) + 0.5)-1))/k) + 0.5 }
14
15# Simplified.
16logistictest <- function(x, k) { (exp(k*x) - 1) / ((exp(0.5*k) - 1) * (1 + exp(k*(x-0.5)))) }
17invlogistictest <- function(x, k) { (log(-(((exp(0.5*k)-1)*x)+1)/((exp(0.5*k)*(x-1))-x))/k)+0.5 }
18
19link1 <- function(x) { lintest(x, 1) }
20
21logk01 <- function(x) { logtest(x, 0.1) }
22logk05 <- function(x) { logtest(x, 0.5) }
23logk1 <- function(x) { logtest(x, 1) }
24logk2 <- function(x) { logtest(x, 2) }
25logk3 <- function(x) { logtest(x, 3) }
26logk4 <- function(x) { logtest(x, 4) }
27logk5 <- function(x) { logtest(x, 5) }
28logk6 <- function(x) { logtest(x, 6) }
29logk7 <- function(x) { logtest(x, 7) }
30logk8 <- function(x) { logtest(x, 8) }
31
32expk01 <- function(x) { exptest(x, 0.1) }
33expk05 <- function(x) { exptest(x, 0.5) }
34expk1 <- function(x) { exptest(x, 1) }
35expk2 <- function(x) { exptest(x, 2) }
36expk3 <- function(x) { exptest(x, 3) }
37expk4 <- function(x) { exptest(x, 4) }
38expk5 <- function(x) { exptest(x, 5) }
39expk6 <- function(x) { exptest(x, 6) }
40expk7 <- function(x) { exptest(x, 7) }
41expk8 <- function(x) { exptest(x, 8) }
42
43polyk1 <- function(x) { polytest(x, 1) }
44polyk2 <- function(x) { polytest(x, 2) }
45polyk3 <- function(x) { polytest(x, 3) }
46polyk4 <- function(x) { polytest(x, 4) }
47polyk5 <- function(x) { polytest(x, 5) }
48polyk6 <- function(x) { polytest(x, 6) }
49polyk7 <- function(x) { polytest(x, 7) }
50polyk8 <- function(x) { polytest(x, 8) }
51polyk_2 <- function(x) { polytest(x, 1/2) }
52polyk_3 <- function(x) { polytest(x, 1/3) }
53polyk_4 <- function(x) { polytest(x, 1/4) }
54polyk_5 <- function(x) { polytest(x, 1/5) }
55polyk_6 <- function(x) { polytest(x, 1/6) }
56polyk_7 <- function(x) { polytest(x, 1/7) }
57polyk_8 <- function(x) { polytest(x, 1/8) }
58
59logisticunormk1 <- function(x) { logistic(x, 1) }
60logisticunormk2 <- function(x) { logistic(x, 2) }
61logisticunormk3 <- function(x) { logistic(x, 3) }
62logisticunormk4 <- function(x) { logistic(x, 4) }
63logisticunormk5 <- function(x) { logistic(x, 5) }
64logisticunormk6 <- function(x) { logistic(x, 6) }
65logisticunormk7 <- function(x) { logistic(x, 7) }
66logisticunormk8 <- function(x) { logistic(x, 8) }
67logisticunormk9 <- function(x) { logistic(x, 9) }
68logisticunormk10 <- function(x) { logistic(x, 10) }
69logisticunormk11 <- function(x) { logistic(x, 11) }
70logisticunormk12 <- function(x) { logistic(x, 12) }
71
72logistick1 <- function(x) { logistictest(x, 1) }
73logistick2 <- function(x) { logistictest(x, 2) }
74logistick3 <- function(x) { logistictest(x, 3) }
75logistick4 <- function(x) { logistictest(x, 4) }
76logistick5 <- function(x) { logistictest(x, 5) }
77logistick6 <- function(x) { logistictest(x, 6) }
78logistick7 <- function(x) { logistictest(x, 7) }
79logistick8 <- function(x) { logistictest(x, 8) }
80logistick9 <- function(x) { logistictest(x, 9) }
81logistick10 <- function(x) { logistictest(x, 10) }
82logistick11 <- function(x) { logistictest(x, 11) }
83logistick12 <- function(x) { logistictest(x, 12) }
84
85invlogisticunormk1 <- function(x) { invlogistic(x, 1) }
86invlogisticunormk2 <- function(x) { invlogistic(x, 2) }
87invlogisticunormk3 <- function(x) { invlogistic(x, 3) }
88invlogisticunormk4 <- function(x) { invlogistic(x, 4) }
89invlogisticunormk5 <- function(x) { invlogistic(x, 5) }
90invlogisticunormk6 <- function(x) { invlogistic(x, 6) }
91invlogisticunormk7 <- function(x) { invlogistic(x, 7) }
92invlogisticunormk8 <- function(x) { invlogistic(x, 8) }
93invlogisticunormk9 <- function(x) { invlogistic(x, 9) }
94invlogisticunormk10 <- function(x) { invlogistic(x, 10) }
95invlogisticunormk11 <- function(x) { invlogistic(x, 11) }
96invlogisticunormk12 <- function(x) { invlogistic(x, 12) }
97
98invlogistick1 <- function(x) { invlogistictest(x, 1) }
99invlogistick2 <- function(x) { invlogistictest(x, 2) }
100invlogistick3 <- function(x) { invlogistictest(x, 3) }
101invlogistick4 <- function(x) { invlogistictest(x, 4) }
102invlogistick5 <- function(x) { invlogistictest(x, 5) }
103invlogistick6 <- function(x) { invlogistictest(x, 6) }
104invlogistick7 <- function(x) { invlogistictest(x, 7) }
105invlogistick8 <- function(x) { invlogistictest(x, 8) }
106invlogistick9 <- function(x) { invlogistictest(x, 9) }
107invlogistick10 <- function(x) { invlogistictest(x, 10) }
108invlogistick11 <- function(x) { invlogistictest(x, 11) }
109invlogistick12 <- function(x) { invlogistictest(x, 12) }
110
111pdf("render.pdf", width=8, height=12)
112par(mfrow=c(3,2))
113
114plot(link1, n=500, xlim=c(0,1), ylim=c(0,1), xlab="", ylab="", sub=expression(y == x), main="Linear mapping")
115
116plot(expk1, xlim=c(0,1), ylim=c(0,1), xlab="", ylab="", sub=expression(y == frac(e^x^k - 1, e - 1)), main="Exponential mapping")
117plot(expk2, n=500, add=TRUE)
118plot(expk3, n=500, add=TRUE)
119plot(expk4, n=500, add=TRUE)
120plot(expk5, n=500, add=TRUE)
121plot(expk6, n=500, add=TRUE)
122plot(expk7, n=500, add=TRUE)
123plot(expk8, n=500, add=TRUE)
124plot(expk01, n=500, add=TRUE)
125plot(expk05, n=500, add=TRUE)
126
127
128plot(logk1, n=500, xlim=c(0,1), ylim=c(0,1), xlab="", ylab="", sub=expression(y == frac(log((x * e^k) - 1) + 1, k)), main="Logarithmic mapping")
129plot(logk2, n=500, add=TRUE)
130plot(logk3, n=500, add=TRUE)
131plot(logk4, n=500, add=TRUE)
132plot(logk5, n=500, add=TRUE)
133plot(logk6, n=500, add=TRUE)
134plot(logk7, n=500, add=TRUE)
135plot(logk8, n=500, add=TRUE)
136plot(logk01, n=500, add=TRUE)
137plot(logk05, n=500, add=TRUE)
138
139
140plot(polyk1, n=500, xlim=c(0,1), ylim=c(0,1), xlab="", ylab="", sub=expression(y == x^k), main="Gamma (\"polynomial\") mapping")
141plot(polyk2, n=500, add=TRUE)
142plot(polyk3, n=500, add=TRUE)
143plot(polyk4, n=500, add=TRUE)
144plot(polyk5, n=500, add=TRUE)
145plot(polyk6, n=500, add=TRUE)
146plot(polyk7, n=500, add=TRUE)
147plot(polyk8, n=500, add=TRUE)
148plot(polyk_2, n=500, add=TRUE)
149plot(polyk_3, n=500, add=TRUE)
150plot(polyk_4, n=500, add=TRUE)
151plot(polyk_5, n=500, add=TRUE)
152plot(polyk_6, n=500, add=TRUE)
153plot(polyk_7, n=500, add=TRUE)
154plot(polyk_8, n=500, add=TRUE)
155
156# plot(logisticunormk1, n=500, xlim=c(0,1), ylim=c(0,1), xlab="", ylab="", sub="Logistic mapping (non-normal)")
157# plot(logisticunormk2, n=500, add=TRUE)
158# plot(logisticunormk3, n=500, add=TRUE)
159# plot(logisticunormk4, n=500, add=TRUE)
160# plot(logisticunormk5, n=500, add=TRUE)
161# plot(logisticunormk6, n=500, add=TRUE)
162# plot(logisticunormk7, n=500, add=TRUE)
163# plot(logisticunormk8, n=500, add=TRUE)
164# plot(logisticunormk9, n=500, add=TRUE)
165# plot(logisticunormk10, n=500, add=TRUE)
166# plot(logisticunormk11, n=500, add=TRUE)
167# plot(logisticunormk12, n=500, add=TRUE)
168
169plot(logistick1, n=500, xlim=c(0,1), ylim=c(0,1), xlab="", ylab="", sub=expression(y == frac(e^{k*x} - 1, (e^{0.5*k} - 1) * (1 + e^{k*(x-0.5)}))), main="Logistic mapping")
170plot(logistick2, n=500, add=TRUE)
171plot(logistick3, n=500, add=TRUE)
172plot(logistick4, n=500, add=TRUE)
173plot(logistick5, n=500, add=TRUE)
174plot(logistick6, n=500, add=TRUE)
175plot(logistick7, n=500, add=TRUE)
176plot(logistick8, n=500, add=TRUE)
177plot(logistick9, n=500, add=TRUE)
178plot(logistick10, n=500, add=TRUE)
179plot(logistick11, n=500, add=TRUE)
180plot(logistick12, n=500, add=TRUE)
181
182# plot(invlogisticunormk1, n=500, xlim=c(0,1), ylim=c(0,1), xlab="", ylab="", sub="Inverse logistic mapping (non-normal)")
183# plot(invlogisticunormk2, n=500, xlim=c(0,1), add=TRUE)
184# plot(invlogisticunormk3, n=500, xlim=c(0,1), add=TRUE)
185# plot(invlogisticunormk4, n=500, xlim=c(0,1), add=TRUE)
186# plot(invlogisticunormk5, n=500, xlim=c(0,1), add=TRUE)
187# plot(invlogisticunormk6, n=500, xlim=c(0,1), add=TRUE)
188# plot(invlogisticunormk7, n=500, xlim=c(0,1), add=TRUE)
189# plot(invlogisticunormk8, n=500, xlim=c(0,1), add=TRUE)
190# plot(invlogisticunormk9, n=500, xlim=c(0,1), add=TRUE)
191# plot(invlogisticunormk10, n=500, xlim=c(0,1), add=TRUE)
192# plot(invlogisticunormk11, n=500, xlim=c(0,1), add=TRUE)
193# plot(invlogisticunormk12, n=500, xlim=c(0,1), add=TRUE)
194
195plot(invlogistick1, n=500, xlim=c(0,1), ylim=c(0,1), xlab="", ylab="", sub=expression(y == frac(log(-frac(((e^{0.5*k}-1)*x)+1, (e^{0.5*k}*(x-1))-x)), k)+0.5), main="Inverse logistic mapping")
196plot(invlogistick2, n=500, xlim=c(0,1), add=TRUE)
197plot(invlogistick3, n=500, xlim=c(0,1), add=TRUE)
198plot(invlogistick4, n=500, xlim=c(0,1), add=TRUE)
199plot(invlogistick5, n=500, xlim=c(0,1), add=TRUE)
200plot(invlogistick6, n=500, xlim=c(0,1), add=TRUE)
201plot(invlogistick7, n=500, xlim=c(0,1), add=TRUE)
202plot(invlogistick8, n=500, xlim=c(0,1), add=TRUE)
203plot(invlogistick9, n=500, xlim=c(0,1), add=TRUE)
204plot(invlogistick10, n=500, xlim=c(0,1), add=TRUE)
205plot(invlogistick11, n=500, xlim=c(0,1), add=TRUE)
206plot(invlogistick12, n=500, xlim=c(0,1), add=TRUE)
207
208dev.off()

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.30959 sec.)

We're Hiring!