GeneralizedAsymmetricLaplace/R/scaleGAL.R

37 lines
940 B
R
Raw Permalink Normal View History

2014-02-11 04:35:26 +00:00
# Apply scale and location transform to the GAL distribution
#
# Author: Francois Pelletier
#
# LGPL 3.0
###############################################################################
#' Apply scale and location transform to the GAL distribution
#' @param param Parameter vector
#' @param type Choose between "mu" or "kappa" parametrization
#' @param location Location shift (unitary)
#' @param scale Scale shift (in standard deviations)
#' @param log Logical for log-parameters
2014-02-11 04:35:26 +00:00
#' @return The transformed parameter vector
#' @export scaleGAL
2014-02-11 04:35:26 +00:00
#' @author Francois Pelletier
scaleGAL <- function(param,type="kappa",location,scale,log=FALSE)
2014-02-11 04:35:26 +00:00
{
if(log)
2014-02-11 04:35:26 +00:00
{
2014-02-11 04:35:26 +00:00
}
else
{
if(type=="kappa")
{
return(param * c(scale,scale,1,1) + c(location,0,0,0))
}
else if (type=="mu")
{
return(changetypeGAL(
scaleGAL(changetypeGAL(param,type="mu",target="kappa"),type="kappa",location,scale),
type="kappa",target="mu"))
}
2014-02-11 04:35:26 +00:00
}
}