
Last chance! 50% off unlimited learning
Sale ends in
To transform a lower or upper distribution in order to find even a better fit for a Density Ratio Class, one has firstly to specify an object of the class transformation
due to the constructors trans.transformationkind.create(par)
that are described in this help sheet.
Secondly, once an object of the class transformation
is created use the function dist.trans.create
to obtain an object of the class distribution
that is finally used for fitting the Density Ratio Class with the help of the function process.elidat
.
Implemented tranformations are the arctan
, tan
, dilation
, log
and a particular trans.exp.create
transformation. They are defined as follows:
arctan: | 0.5*(Min+Max) + (Max-Min)/pi*atan(x) |
tan: | tan(0.5*pi*(2*x-Max-Min)/(Max-Min)) |
dil: | (x-Min1) * (Max2-Min2)/(Max1-Min1) + Min2 |
log: | log(x) |
exp: | -(a/b^2) * exp(-b*x) + c*x + (a/b^2) |
It is also possible to implement an own object of the class transformation
. Do this by using the template below from the example section.
trans.arctan.create(par = NA)
trans.tan.create(par = NA)
trans.dil.create(par = NA)
trans.log.create(par = NA)
trans.exp.create(par = NA)# S3 method for transformation
print(x = trans,...)
# S3 method for transformation
summary(object,...)
# S3 method for transformation
plot(x = trans, par = trans$par,
range.x = NA, range.y = NA, what = "TRANS.FORW", plot = TRUE,
length = 101,...)
vector of the parameters of the transformation, if not named in the implemented order. At least one parameter value has to be specified. Unspecified values will be default values as in the list below:
arctan: | par = c("Min" = 0, "Max" = 1) |
tan: | par = c("Min" = 0,"Max" = 1) |
dil: | par = c("Min1" = 0, "Max1" = 1, "Min2" = 0, "Max2" = 1) |
log: | par = c("-" = NA) |
exp: | par = c("a" = 0, "b" = 1, "c" = 0) |
object of the class transformation
.
object of the class transformation
.
used in the method plot
; if TRUE creates a plot, else returns values.
used in the method plot
; can be either TRANS.FORW
or TRANS.BACKW
or TRANS.DERIV
and defines what is to be plotted.
specifies the x-range of the plot in the method plot
.
specifies the y-range of the plot in the method plot
.
specifies the number of evaluations within the range for the plot in the method plot
.
further arguments that can be passed to the function.
the name of the transformation
the x-range of the transformation
the y-range of the transformation
the names of the transformation parameters
the ranges of the transformation parameters
the values of the transformation parameters
a function to calculate the forward transformation
a function to calculate the backward transformation
a function to calculate the derivation of the transformation
Implemented methods for objects of the class transformation
are: print
summary
plot
.
Rinderknecht, S.L., Borsuk, M.E. and Reichert, P. Eliciting Density Ratio Classes. International Journal of Approximate Reasoning 52, 792-804, 2011. doi10.1016/j.ijar.2011.02.002. \ Rinderknecht, S. L., Borsuk, M. E. and Reichert, P. Bridging Uncertain and Ambiguous Knowledge with Imprecise Probabilities, Environmental Modelling & Software 36, 122-130, 2012.
# NOT RUN {
trans.arctan <- trans.arctan.create(c(0,10))
print(trans.arctan)
summary(trans.arctan)
#x11()
#plot(trans.arctan)
#plot(trans.arctan,what = "TRANS.BACKW")
#plot(trans.arctan,what = "TRANS.DERIV")
trans.tan <- trans.tan.create(c(0,10))
#x11()
#plot(trans.tan)
#plot(trans.tan,what = "TRANS.BACKW")
#plot(trans.tan,what = "TRANS.DERIV")
trans.log <- trans.log.create()
#x11()
#plot(trans.log,range.x=c(-1,1))
#plot(trans.log,what = "TRANS.BACKW",range.y=c(-1,1))
#plot(trans.log,what = "TRANS.DERIV",range.x=c(-1,1))
trans.dil <- trans.dil.create(c(0,1,4,5))
#x11()
#plot(trans.dil,range.x=c(-1,1))
#plot(trans.dil,what = "TRANS.BACKW", range.y = c(-1,1))
#plot(trans.dil,what = "TRANS.DERIV", range.x = c(-1,1))
trans.exp <- trans.exp.create(c(3, 2, 1))
#x11()
#plot(trans.exp,range.x=c(-1,1))
#plot(trans.exp,what = "TRANS.BACKW", range.y = c(-4,3))
#plot(trans.exp,what = "TRANS.DERIV", range.x = c(-1,1))
# implemented default values are:
trans.arctan.create(par = c(Min = 0, Max = 1))
trans.tan.create(par = c(Min = 0, Max = 1))
trans.dil.create(par = c("Min1" = 0, "Max1" = 1, "Min2" = 0, "Max2" = 1))
trans.log.create(par = c("-" = NA))
trans.exp.create(par = c("a" = 0, "b" = 1, "c" = 0))
##############################################################################
### if you want to create your own transformation read this ###
##############################################################################
# use the template below and replace the code in between *<* ... *>*
# accordingly. Do not forget to delete the *<* and *>* that are only used to
# indicate the custom fields.
# type 'trans.exp.create' to see an already implemented transformation.
################################################################################
### if you want to create your own transformation use the following template ###
################################################################################
# trans.*<*yournameofyourtransformation*>*.create <- function(par=c(NA)
# {
# # set default parameter values:
# par.default <- c(*<*NA,...*>*)
# names(par.default) <- c(*<*"a",...*>*)
# p <- mergePar(par,par.default)
# # construct class:
# trans <- list()
# trans$name <- "*<*yourname"*>*
# trans$range.x <- function(par){*<*return(c(min.x,max.x))*>*}
# trans$range.y <- function(par){*<*return(c(min.y,max.y))*>*}
# trans$par.names <- names(p)
# # ranges of the parameters of the transformation
# trans$par.ranges <- matrix(
# c(*<*-NA, +NA*>*, # range of 1st parameter
# *<*-NA, +NA*>*), # range of 2nd par.....
# byrow=TRUE,ncol=2)
# trans$par <- p
# trans$trans.forw <- function(x,par)
# { y <- *<*yourForwardFormula(x,par)*>*
# return(as.numeric(y))
# }
# trans$trans.backw <- function(y,par)
# { x <- *<*yourBackwardFormula(y,par)*>*
# return(as.numeric(x)) }
# trans$trans.deriv <- function(x,par)
# { dydx <- *<*yourDerivationFormula(x,par)*>*
# return(as.numeric(dydx)) }
# class(trans) <- "transformation"
# return(trans)
# }
# }
Run the code above in your browser using DataLab