fitDRC (version 1.1.1)

Distributions: The class `distribution' in the fitDRC-package: its constructors and methods.

Description

Lower and upper distributions of the Density Ratio Class must be in the form of an object of the class distribution such as described in this sheet. Objects of the class distribution can be used in a second step in function process.elidat that finally yields the smallest Density Ratio Class given the the probability-quantile intervals/poins. The described functions below create distribution objects for wich some methods are implemented too. The distributional parameter(s) (at least one) that finally shall be optimized for the smallest Density Ratio Class must be specified with name. For transformed distributions see transformation and dist.trans.create.

Usage

dist.normal.create(par = NA)
dist.student.create(par = NA)
dist.weibull.create(par = NA)
dist.lognormal.create(par = NA)
dist.beta.create(par = NA)
dist.gamma.create(par = NA)
dist.f.create(par = NA)
dist.uniform.create(par= NA)
dist.logistic.create(par = NA)

# S3 method for distribution print(x = dist,...) # S3 method for distribution summary(object = dist,...) # S3 method for distribution plot(x = dist, par = dist$par, range = NA, what = "PDF", plot = TRUE, length = 101, ...) # S3 method for distribution PDF(dist, x, par = dist$par, log = FALSE,...) # S3 method for distribution CDF(dist, x, par = dist$par,...) # S3 method for distribution CDFinv(dist, p, par = dist$par,...) # S3 method for distribution RANGE(dist, par = dist$par,...) # S3 method for distribution MEAN(dist, par = dist$par, ...) # S3 method for distribution SD(dist, par = dist$par, ...) # S3 method for distribution MEDIAN(dist, par = dist$par, ...) # S3 method for distribution MODE(dist, par = dist$par, ...)

Arguments

par

vector of the parameters of the distribution, if not named in the implemented order as shown in the list below for each implemented distribution. At least one parameter value has to be specified. Unspecified parameter values will take the default values (see list below).

normal: par = c("Mean" = 0,"StDev" = 1)
student: par = c("Mean" = 0, "StDev" = 1, "DF" = 3)
weibull: par = c("Shape" = 2, "Scale" = 2 )
lognormal: par = c("Mean" = 1, "StDev" = 1)
beta: par = c("Shape1" = 1,"Shape2" = 1)
gamma: par = c("shape" = 1,"rate" = 1)
f: par = c("df1" = 3, "df2" = 5, "ncp" = 0)
uniform: par = c("Min" = 0,"Max" = 1)
logistic: par = c("Location" = 0,"Scale" = 1)
dist

object of class distribution.

x

in dependence of the function either an object of the class distribution or the location of where to evaluate the distribution.

object

object of the class distribution.

p

probability of where the inverse distribution has to be evaluated.

range

used in the method plot: specifies the plot range

what

determines what to plot or calculate, can be set to: PDF, CDF or CDFinv.

plot

argument used in the method plot: creates a plot if set to TRUE, returns a matrix with x an y column if set to FALSE.

length

plot resolution.

log

if TRUE the logarithm of the PDF is returned, default is FALSE.

...

further arguments that can be passed to a function.

Value

name

the name of the distribution

range

the range of the distribution

par.names

the names of the parameters of the distribution

par.ranges

the ranges of the parameters of the distribution

par

the values of the parameters of the distribution

mean

a function to calculate the mean of the distribution

sd

a function to calculate the standard deviation of the distribution

median

a function to calculate the median of the normal distribution

mode

a function to calculate the mode of the distribution (does not exist for e.g. the Uniform distribution)

pdf

a function to calculate the pdf (probability density function) of the distribution

cdf

a function to calculate cdf (cumulative distribution function) of the distribution

cdf.inv

a function to calculate the inverse cdf of the distribution

Details

Implement your own distribution using the template from the example section below if the distribution you are looking for is not implemented.

References

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.

See Also

See also fitDRC for general information and transformation, dist.trans.create for transformed distributions.

Examples

Run this code
# NOT RUN {
print(dist.normal.create(c(Mean = 0, StDev = 1)))
print(dist.student.create(c(DF=99)))
dist.weibull.create(c(Shape=2,Scale=99))
summary(dist.lognormal.create(c(StDev=2)))

plot(dist.beta.create(c(2,1)),plot=FALSE)
plot(dist.gamma.create(c(2,1)),main="myGamma",xlab="x",ylab="pdf")
plot(dist.f.create(c(ncp=99)),main="F",what="CDF",xlab="x",ylab="cdf")
plot(dist.uniform.create(c(-1,1)),main="Uniform",what="CDFinv",xlab="p",ylab="inv-cdf")
plot(dist.logistic.create(c(2,1)),par=c(Scale=5))

dist.normal <- dist.normal.create(c(StDev=2))
is(dist.normal)                       # element of class distribution
plot(dist.normal,par=c(StDev=3))
dist.normal$par <- c(2,2)             # "permanent" parameter change
plot(dist.normal)
plot(dist.normal, par = c(Mean = 0))  # "temporary" parameter change

# Default setting of the parameters:

dist.normal.create(par = c(Mean = 0, StDev = 1))
dist.student.create(par = c("Mean" = 0, "StDev" = 1, "DF" = 3))
dist.weibull.create(par = c( "Shape" = 2, "Scale" = 2 ))
dist.lognormal.create(par = c("Mean" = 1, "StDev" = 1))
dist.beta.create(par = c("Shape1" = 1, "Shape2" = 1))
dist.gamma.create(par = c("shape" = 1, "rate" = 1))
dist.f.create(par = c("df1" = 3,"df2" = 5, "ncp" = 0))
dist.uniform.create(par= c("Min" = 0, "Max" = 1))
dist.logistic.create(par = c("Location" = 0,"Scale" = 1))



##############################################################################
       ### if you want to create your own distribution 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 'dist.normal.create' to see an already implemented distribution.

##############################################################################
### if you want to create your own distribution use the following template ###
##############################################################################

# dist.*<*YourDistributionFamilyName*>*.create <- function(par=NA)
# {
#   # set default parameter values:
#   par.default <- c(*<*YourFirstParamterDefaulValue, ...*>*)
#   names(par.default) <- c( *<*"YourParameterNameOfYourFirstParamter", "..."*>* )
#   p <- mergePar(par,par.default)
#   # construct class:
#   dist            <- list()
#   dist$name       <- "*<*YourDistributionName*>*"
#   dist$range      <- function(par) # range of the distribution
#                      {
#                         return(c(*<*YourLowerRange,YourUperRange*>*))
#                     }
#   dist$par.names  <- names(p)
#   dist$par.ranges <- matrix(
#                             c(*<*-NA, +NA,*>*      # ranges of par01
#                               *<*-NA, +NA*>*),     # ...
#                               byrow=TRUE,ncol=2)
#   dist$par        <- p
#   dist$mean       <- function(par)
#                      {
#                         mean <- *<*MeanFormula(par)*>*
#   	                  names(mean) <- "Mean"
#   	                  return(mean)
#   	                  }
#   dist$sd         <- function(par) 
#                      {
#                      	 sd <- *<*StandardDevFormula(par)*>* 
#                        names(sd) <- "StDev"
#                        return(sd)
#                      }
#   dist$median     <- function(par)
#                      { 
#                        median <- *<*MedianFormula(par)*>*
#                      	 names(median) <- "Median"
#                      	 return(median)
#                      }
#   dist$mode       <- function(par)
#                     { 
#                      	 mode <- *<*ModeFormula(par)*>*
#                        names(mode) <- "Mode"
#                        return(mode)
#                      }
#   dist$pdf        <- function(x,par) { return( *<*dyourdist(x, par)*>* ) }
#   dist$cdf        <- function(x,par) { return( *<*pyourdist(x, par)*>* ) }
#   dist$cdf.inv    <- function(p,par) { return( *<*qyourdist(p, par)*>* ) }
#   class(dist)     <- "distribution"
#   return(dist)
#}

# }

Run the code above in your browser using DataLab