From b19ce5e6bfb269766e5c535ad951b0f39890c6e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pelletier?= Date: Mon, 10 Feb 2014 23:35:26 -0500 Subject: [PATCH] ajout de scaleGAL --- .../.launches/MyConsole.launch | 4 +-- R/scaleGAL.R | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 R/scaleGAL.R diff --git a/.metadata/.plugins/org.eclipse.debug.core/.launches/MyConsole.launch b/.metadata/.plugins/org.eclipse.debug.core/.launches/MyConsole.launch index 8300e39..00a1c0c 100644 --- a/.metadata/.plugins/org.eclipse.debug.core/.launches/MyConsole.launch +++ b/.metadata/.plugins/org.eclipse.debug.core/.launches/MyConsole.launch @@ -8,12 +8,12 @@ - + - + diff --git a/R/scaleGAL.R b/R/scaleGAL.R new file mode 100644 index 0000000..ffd1961 --- /dev/null +++ b/R/scaleGAL.R @@ -0,0 +1,29 @@ +# 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) +#' @return The transformed parameter vector +#' +#' @author Francois Pelletier +scaleGAL <- function(param,type="kappa",location,scale) +{ + if(type=="kappa") + { + param * c(scale,scale,1,1) + c(location,0,0,0) + } + else + { + changetypeGAL( + scaleGAL(changetypeGAL(param,type="mu",target="kappa"),type="kappa",location,scale), + type="kappa",target="mu") + } +}