Library: | insurance |
See also: | INSmoments |
Quantlet: | INSmgfs | |
Description: | returns the moment generating function or its k-th derivative (up to third) for a light tailed distribution. |
Usage: | y = INSmgfs(x, distrib, k, dparameters) | |
Input: | ||
x | scalar, n x 1 vector or m x n matrix, argument of the moment generating function | |
distrib | string, name of distribution, either gamma, exponential or mixofexps | |
k | scalar, integer, 0 =< k <= 3, order of the derivative | |
dparameters | list of scalars, parameters of gamma or exponential distributions list of n x 1 vectors of parameters of "mixofexps" distribution, the first vector are parameters for the exponential distributions and the second one are the weights of mixing | |
Output: | ||
y | scalar, n x 1 vector or m x n matrix (same dimension as x), moment generating function from the distribution or its k-th derivative. |
library("insurance") library("plot") distrib = "gamma" dparameters = list(0.2,0.7) x = #(0:10)/50 y = INSmgfs(x, distrib, 1, dparameters) y disp = createdisplay(1,1) show(disp, 1, 1,setmask(x~y, "line", "red")) setgopt(disp, 1, 1,"xvalue",0|1,"yvalue",0|1)
Moment generating function of gamma distribution and its plot: Contents of y [ 1,] 0.28571 [ 2,] 0.29583 [ 3,] 0.30662 [ 4,] 0.31815 [ 5,] 0.33051 [ 6,] 0.34377 [ 7,] 0.35804 [ 8,] 0.37344 [ 9,] 0.3901 [10,] 0.40817 [11,] 0.42784