diff --git a/R/emk.R b/R/emk.R new file mode 100644 index 0000000..97c174b --- /dev/null +++ b/R/emk.R @@ -0,0 +1,20 @@ +# Empirical cumulants for individual data +# +# Author: François Pelletier +############################################################################### + + +#' Empirical cumulants for individual data +#' @param DATA a vector of individual data +#' @param order order of the cumulant. Must be between 1 and 4. +#' @return A vector of cumulants +#' @author François Pelletier +emk <- function(DATA,order=1:4) +{ + library(actuar) + m <- emm(DATA,1:4) + c(m[1], + m[2]-m[1]^2, + m[3]-3*m[1]*m[2]+2*m[1]^2, + m[4]-3*m[2]^2-4*m[1]*m[3]+12*m[1]^2*m[2]-6*m[1]^4)[order] +} diff --git a/R/empCF.R b/R/empCF.R new file mode 100644 index 0000000..7cad2ec --- /dev/null +++ b/R/empCF.R @@ -0,0 +1,17 @@ +# Empirical Characteristic function +# +# Author: François Pelletier +############################################################################### + + +#' Empirical Characteristic function +#' +#' Evaluate the empirical CF from a data sample +#' @param t Vector of transform variates +#' @param DATA Vector of individual data +#' @return A vector of CF values +#' @author François Pelletier +empCF <- function(t,DATA) +{ + colMeans(outer(DATA,t,function(x,y) exp(1i*x*y))) +} diff --git a/R/empCGF.R b/R/empCGF.R new file mode 100644 index 0000000..c9753f3 --- /dev/null +++ b/R/empCGF.R @@ -0,0 +1,17 @@ +# Empirical Cumulant Generating function +# +# Author: François Pelletier +############################################################################### + + +#' Empirical Coment Generating function +#' +#' Evaluate the empirical CGF from a data sample +#' @param t Vector of transform variates +#' @param DATA Vector of individual data +#' @return A vector of CGF values +#' @author François Pelletier +empCGF <- function(t,DATA) +{ + log(colMeans(outer(DATA,t,function(x,y) exp(x*y)))) +} diff --git a/R/empMGF.R b/R/empMGF.R new file mode 100644 index 0000000..63e5e71 --- /dev/null +++ b/R/empMGF.R @@ -0,0 +1,17 @@ +# Empirical Moment Generating function +# +# Author: François Pelletier +############################################################################### + + +#' Empirical Moment Generating function +#' +#' Evaluate the empirical MGF from a data sample +#' @param t Vector of transform variates +#' @param DATA Vector of individual data +#' @return A vector of MGF values +#' @author François Pelletier +empMGF <- function(t,DATA) +{ + colMeans(outer(DATA,t,function(x,y) exp(x*y))) +} diff --git a/man/emk.Rd b/man/emk.Rd new file mode 100644 index 0000000..7240173 --- /dev/null +++ b/man/emk.Rd @@ -0,0 +1,22 @@ +\name{emk} +\alias{emk} +\title{Empirical cumulants for individual data} +\usage{ +emk(DATA, order = 1:4) +} +\arguments{ + \item{DATA}{a vector of individual data} + + \item{order}{order of the cumulant. Must be between 1 and + 4.} +} +\value{ +A vector of cumulants +} +\description{ +Empirical cumulants for individual data +} +\author{ +François Pelletier +} + diff --git a/man/empCF.Rd b/man/empCF.Rd new file mode 100644 index 0000000..00e16ff --- /dev/null +++ b/man/empCF.Rd @@ -0,0 +1,21 @@ +\name{empCF} +\alias{empCF} +\title{Empirical Characteristic function} +\usage{ +empCF(t, DATA) +} +\arguments{ + \item{t}{Vector of transform variates} + + \item{DATA}{Vector of individual data} +} +\value{ +A vector of CF values +} +\description{ +Evaluate the empirical CF from a data sample +} +\author{ +François Pelletier +} + diff --git a/man/empCGF.Rd b/man/empCGF.Rd new file mode 100644 index 0000000..0737410 --- /dev/null +++ b/man/empCGF.Rd @@ -0,0 +1,21 @@ +\name{empCGF} +\alias{empCGF} +\title{Empirical Coment Generating function} +\usage{ +empCGF(t, DATA) +} +\arguments{ + \item{t}{Vector of transform variates} + + \item{DATA}{Vector of individual data} +} +\value{ +A vector of CGF values +} +\description{ +Evaluate the empirical CGF from a data sample +} +\author{ +François Pelletier +} + diff --git a/man/empMGF.Rd b/man/empMGF.Rd new file mode 100644 index 0000000..7f571d5 --- /dev/null +++ b/man/empMGF.Rd @@ -0,0 +1,21 @@ +\name{empMGF} +\alias{empMGF} +\title{Empirical Moment Generating function} +\usage{ +empMGF(t, DATA) +} +\arguments{ + \item{t}{Vector of transform variates} + + \item{DATA}{Vector of individual data} +} +\value{ +A vector of MGF values +} +\description{ +Evaluate the empirical MGF from a data sample +} +\author{ +François Pelletier +} +