-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.R
57 lines (40 loc) · 900 Bytes
/
main.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
x = runif(100,0,1)
##################################################pareto
a=2
b=2.5
y = a / exp((1/b)*log(1-x))
range(y)
mean(y)
#jpeg('/home/farnaz/Desktop/rhist1.jpg')
hist(y)
#dev.off()
#jpeg('/home/farnaz/Desktop/rplot1.jpg')
plot(y, type='l')
#dev.off()
##################################################lognormal
mu = 0;
sigma = 0.5;
invErf <- function(x) {
# argument x must lie between -1 and 1
qnorm((1 + x) /2) / sqrt(2)
}
y = exp( (sigma*sqrt(2)*invErf(2*x - 1))+mu )
range(y)
mean(y)
#jpeg('/home/farnaz/Desktop/rhist.jpg')
hist(y)
#dev.off()
#jpeg('/home/farnaz/Desktop/rplot.jpg')
plot(y, type='l')
#dev.off()
##############################################stretched exponential
beta = 0.52
y = (-log(x))^(1/beta)
range(y)
mean(y)
#jpeg('/home/farnaz/Desktop/rhist.jpg')
hist(y)
#dev.off()
#jpeg('/home/farnaz/Desktop/rplot.jpg')
plot(y, type='l')
#dev.off()