ecf: Empirical characteristic function

Description Usage Arguments Value Examples

Description

It computes the d-dimensional empirical characteristic function

Usage

1
ecf(t, samp)

Arguments

t

d-variate vector where the ecf will be evaluated

samp

nxd matrix with the n samples

Value

A complex value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library(mvdeconvolution)
library(reshape2)
library(ggplot2)

## Example 1
## Real and imag. parts of exponential dist.
samp <- rexp(60)
t <- seq(-3, 3, len = 150)
vals <- sapply(t, ecf, samp)
real <- Re(vals)
imag <- Im(vals)
## ## Plot values. Uncomment below
## df <- data.frame(t, real, imag)
## df.molten <- melt(df, id = "t")
## head(df.molten)
## qplot(t, value, data = df.molten, geom = 'line',
##       facets = . ~ variable)

## Example 2
## Real part of bivariate normal emp. ch. fnc.
samp <- cbind(rnorm(100), rnorm(100))
t1 <- seq(-3, 3, len = 150)
t2 <- t1
t <- expand.grid(t1, t2)
ecf.vals <- apply(t, 1, ecf, samp)
re.vals <- matrix(Re(ecf.vals), 150, 150)
persp(t1, t2, re.vals)

gbasulto/mvdeconvolution documentation built on May 16, 2019, 10:11 p.m.