moment2fmx {fmx}R Documentation

Creates fmx Object with Given Component-Wise Moments

Description

Creates fmx Object with Given Component-Wise Moments

Usage

moment2fmx(distname, w, ...)

Arguments

distname

character scalar

w

numeric vector

...

numeric scalars, some or all of mean, sd, skewness and kurtosis (length will be recycled), see moment2param

Value

Function moment2fmx returns a fmx object.

Examples

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))


[Package fmx version 0.1.2 Index]