Ajout de l'intégrale pGAL

This commit is contained in:
François Pelletier 2014-03-15 11:43:24 -04:00
parent 2a94c8656e
commit 6fedfa826e
5 changed files with 57 additions and 2 deletions

View file

@ -15,6 +15,7 @@ export(dscaleGAL)
export(mGAL)
export(mean.variance.GMM.gradient.GAL)
export(mgfGAL)
export(pGAL)
export(pnormapproxEsscherLM)
export(psaddleapproxEsscherGAL)
export(psaddleapproxGAL)

View file

@ -1,3 +1,10 @@
# Density function for the GAL distribution
#
# Author: François Pelletier
#
# LGPL 3.0
###############################################################################
#' Density function for the GAL distribution
#' @param x vector of quantiles
#' @param param Parameter vector

21
R/pGAL.R Normal file
View file

@ -0,0 +1,21 @@
# Distribution function for the GAL distribution
#
# Author: François Pelletier
#
# LGPL 3.0
###############################################################################
#' Distribution function for the GAL distribution
#' @param x vector of quantiles
#' @param param Parameter vector
#' @param type Choose between "mu" or "kappa" parametrization
#' @param log Logical for log-parameters
#' @return distribution at quantile x
#' @export pGAL
#' @author Francois Pelletier
pGAL <- function(x,param,type="mu",log=FALSE)
{
x.l <- as.list(x)
integrate1 <- function(x,param,type,log) integrate(dGAL,-Inf,x,param=param,type=type,log=log)$value
unlist(lapply(x.l,integrate1,param,type,log))
}

View file

@ -22,8 +22,8 @@ psaddleapproxGAL <- function(x,param,eval.time=1,type="mu",log=FALSE)
u <- s * sqrt(diffcgfGAL(s,2,param,eval.time,type,log))
w <- sign(s)*sqrt(2*(s*x-cgfGAL(s,param,type,log)))
(x==mGAL(param,1,type,log)) * (1/2 + diffcgfGAL(0,3,param,eval.time,type,log)/
(x==round(mGAL(param,1,type,log),4)) * (1/2 + diffcgfGAL(0,3,param,eval.time,type,log)/
(6*sqrt(2*pi)*diffcgfGAL(0,2,param,eval.time,type,log)^(3/2))) +
(x!=mGAL(param,1,type,log)) * pnorm(w)+dnorm(w)*(1/w-1/u)
(x!=round(mGAL(param,1,type,log),4)) * (pnorm(w)+dnorm(w)*(1/w-1/u))
}

26
man/pGAL.Rd Normal file
View file

@ -0,0 +1,26 @@
\name{pGAL}
\alias{pGAL}
\title{Distribution function for the GAL distribution}
\usage{
pGAL(x, param, type = "mu", log = FALSE)
}
\arguments{
\item{x}{vector of quantiles}
\item{param}{Parameter vector}
\item{type}{Choose between "mu" or "kappa"
parametrization}
\item{log}{Logical for log-parameters}
}
\value{
distribution at quantile x
}
\description{
Distribution function for the GAL distribution
}
\author{
Francois Pelletier
}