Ajout de fonctions pour les quantités empiriques

This commit is contained in:
François Pelletier 2014-02-19 21:49:11 -05:00
parent ee851a9e0f
commit 01505a567b
8 changed files with 156 additions and 0 deletions

20
R/emk.R Normal file
View file

@ -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]
}

17
R/empCF.R Normal file
View file

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

17
R/empCGF.R Normal file
View file

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

17
R/empMGF.R Normal file
View file

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

22
man/emk.Rd Normal file
View file

@ -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
}

21
man/empCF.Rd Normal file
View file

@ -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
}

21
man/empCGF.Rd Normal file
View file

@ -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
}

21
man/empMGF.Rd Normal file
View file

@ -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
}