ajout du projet existant

This commit is contained in:
François Pelletier 2014-02-01 21:15:59 -05:00
parent f066ad835d
commit 4749acaf87
6 changed files with 97 additions and 0 deletions

19
.project Normal file
View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>FourierStuff</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>de.walware.statet.r.builders.RSupport</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>de.walware.statet.base.StatetNature</nature>
<nature>de.walware.statet.r.RNature</nature>
<nature>de.walware.statet.r.RPkgNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,2 @@
RProjectBuild/Package.name=FourierStuff
eclipse.preferences.version=1

9
DESCRIPTION Normal file
View file

@ -0,0 +1,9 @@
Package: FourierStuff
Title: Some probability stuff around Fourier transforms
Version: 0.1
Date: 2014-01-06
Author: Francois Pelletier
Maintainer: Francois Pelletier <francois@francoispelletier.org>
Description: This is a package gathering different functions to work with the
characteristic function and Fourier transforms
License: LGPL-3

0
NAMESPACE Normal file
View file

34
R/fft.density.R Normal file
View file

@ -0,0 +1,34 @@
# Get density from characteristic function
#
# Author: François Pelletier
###############################################################################
#' Get density from characteristic function
#'
#' @param char.fun Vectorized characteristic function
#' @param n Amount of discretization points
#' @param min Lower bound for density function
#' @param max Upper bound for density function
#' @return A data.frame object containing
#' @return transform.grid: transform variate grid
#' @return char.fun.t: characteristic function evaluated at t
#' @return density.grid: density function grid
#' @return density.value: density function evaluated at point x
#' @author François Pelletier
fft.density <- function(char.fun,n,min,max,...)
{
index <- 0:(n-1) # Index
density.step <- (max-min)/n # Step for density function
density.grid <- min + index * density.step # Grid for density function
transform.step <- 2*pi / ( n * density.step) # Step for transform variate
lbound.char.fun <- -n/2 * transform.step # Evaluate characteristic function on range [c,d]
ubound.char.fun <- n/2 * transform.step # Range centered at 0
transform.grid <- lbound.char.fun + index * transform.step # Grid for transform variate
char.fun.t <- char.fun(transform.grid,...) # Evaluate characteristifc function
tilted.char.fun.t <- exp( -1i * index * transform.step * min ) * char.fun.t # Tilt characteristic function
density.value <- Re(transform.step / (2*pi) * exp( - 1i * lbound.char.fun * density.grid ) * fft(tilted.char.fun.t)) #Use FFT to get density value, then untilt and normalize
data.frame(transform.grid,char.fun.t,density.grid,density.value)
}

33
man/fft.density.Rd Normal file
View file

@ -0,0 +1,33 @@
\name{fft.density}
\alias{fft.density}
\title{Get density from characteristic function}
\usage{
fft.density(char.fun, n, min, max, ...)
}
\arguments{
\item{char.fun}{Vectorized characteristic function}
\item{n}{Amount of discretization points}
\item{min}{Lower bound for density function}
\item{max}{Upper bound for density function}
}
\value{
A data.frame object containing
transform.grid: transform variate grid
char.fun.t: characteristic function evaluated at t
density.grid: density function grid
density.value: density function evaluated at point x
}
\description{
Get density from characteristic function
}
\author{
François Pelletier
}