FourierStuff/R/empMGF.R

19 lines
490 B
R
Raw Permalink Normal View History

# 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
#' @export empMGF
#' @author François Pelletier
empMGF <- function(t,DATA)
{
colMeans(outer(DATA,t,function(x,y) exp(x*y)))
}