-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasicfunctions-EV-II
More file actions
42 lines (35 loc) · 2 KB
/
Copy pathbasicfunctions-EV-II
File metadata and controls
42 lines (35 loc) · 2 KB
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
#########################################################################################################################
#### basic function for Gumbel type 2 distribution - Maximum
#########################################################################################################################
#########################################################################################################################
### Package
#########################################################################################################################
require(compiler) # speed up R
enableJIT(3)
#########################################################################################################################
### Euler Constant
#########################################################################################################################
J <- -digamma(1)
#########################################################################################################################
### Gumbel type-2 density function
#########################################################################################################################
f <- function(x, mu, sig) {
z = (x-mu)/sig
d = exp(-z-exp(-z))/sig
return(d)
}
#########################################################################################################################
### Gumbel type-2 distribution function
#########################################################################################################################
# F <- function(x, mu, sigma) {
# exp(-exp(-(x-mu)/sigma))
# }
#########################################################################################################################
### Random number generator using inverse CDF
#########################################################################################################################
rgumax <- function(n, mu, sig) {
x <- mu - sig*(log(-log(runif(n))))
x
}
# n <- 100
# y <- rgumax(n, 3, .01)