Consider this (R) data:
nd1 <- rnorm(100)
nd2 <- rnorm(100)
pd1 <- rpois(100, 2)
pd2 <- rpois(100, 2)
I want to define two functions - f1 and f2:
f1 <- function(vec) {...}
f2 <- function(vec1, vec2) {...}
f1 should return a list of pairs: standard dist name, similarity value. For example:
# returns
f1(nd1)
normal 0.9
poisson 0.1
...
f1(pd1)
normal 0.1
poisson 0.9
...
f2 should return a number that shows how similar two distributions are to each other, in terms of the standard distributions:
f2(nd1, nd2) # high value, say, 0.9 (because both are random normal distributions)
f2(nd1, pd1) # low value, say, 0.1
f2(pd1, pd2) # high value, say, 0.9
How do I implement these functions f1 and f2? Are there pre-built functions in R that can do this?
I saw this other question that mentions the Kullback–Leibler divergence, but not sure if that can be used to define these functions.