Creates fmx Object with Given Component-Wise Moments
moment2fmx(distname, w, ...)
distname
: character scalar
w
: numeric vector
...
: numeric scalars, some or all of mean
, sd
, skewness
and kurtosis
(length will be recycled), see moment2param
Function moment2fmx()
returns a fmx object.
m = c(-1.5, 1.5) s = c(.9, 1.1) sk = c(.2, -.3) kt = c(.5, .75) w = c(2, 3) (d1 = moment2fmx(distname='GH', w=w, mean=m, sd=s, skewness=sk, kurtosis=kt)) moment_fmx(d1) (d2 = moment2fmx(distname='st', w=w, mean=m, sd=s, skewness=sk, kurtosis=kt)) moment_fmx(d2) library(ggplot2) ggplot() + geom_function(aes(color = 'GH'), fun = dfmx, args = list(dist=d1), n = 1001) + geom_function(aes(color = 'st'), fun = dfmx, args = list(dist=d1), n = 1001) + xlim(-5, 6) # two curves looks really close, but actually not identical x = rfmx(n = 1e3L, dist = d1) range(dfmx(x, dist = d1) - dfmx(x, dist = d2))
Useful links