Last data update: 2014.03.03

R: The Log Uniform Distribution
dlunifR Documentation

The Log Uniform Distribution

Description

Density, distribution function, quantile function and random generation for the log uniform distribution in the interval from min to max. Parameters must be raw values (not log-transformed) and will be log-transformed using specified base.

Usage

dlunif(x, min, max, base = exp(1))

plunif(q, min, max, base = exp(1))

qlunif(p, min, max, base = exp(1))

rlunif(n, min, max, base = exp(1))

Arguments

x

Vector of quantiles.

min

Lower limit of the distribution, in raw (not log-transformed) values. Negative values will give warning.

max

Upper limit of the distribution, in raw (not log-transformed) values. Negative values will give warning.

base

The base to which logarithms are computed. Defaults to e=exp(1). Must be a positive number.

q

Vector of quantiles.

p

Vector of probabilities.

n

Number of observations.

Details

A log uniform (or loguniform or log-uniform) random variable has a uniform distribution when log-transformed.

Value

dlunif gives the density, plunif gives the distribution function, qlunif gives the quantile function, and rlunif generates random numbers.

Note

Parameters min, max must be provided as raw (not log-transformed) values and will be log-transformed using base. In other words, when log-transformed, a log uniform random variable with parameters min=a and max=b is uniform over the interval from log(a) to log(b).

Author(s)

Steve Wang scwang@swarthmore.edu

See Also

Distributions for other standard distributions

Examples

plot(1:100, dlunif(1:100, exp(1), exp(10)), type="l", main="Loguniform density")
plot(log(1:100), dlunif(log(1:100), log(1), log(10)), type="l",
     main="Loguniform density")

plot(1:100, plunif(1:100, exp(1), exp(10)), type="l", main="Loguniform cumulative")
plot(qlunif(ppoints(100), exp(1), exp(10)), type="l", main="Loguniform quantile")

hist(rlunif(1000, exp(1), exp(10)), main="random loguniform sample")
hist(log(rlunif(10000, exp(1), exp(10))), main="random loguniform sample")
hist(log(rlunif(10000, exp(1), exp(10), base=10), base=10), main="random loguniform sample")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(KScorrect)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/KScorrect/dlunif.Rd_%03d_medium.png", width=480, height=480)
> ### Name: dlunif
> ### Title: The Log Uniform Distribution
> ### Aliases: dlunif plunif qlunif rlunif
> 
> ### ** Examples
> 
> plot(1:100, dlunif(1:100, exp(1), exp(10)), type="l", main="Loguniform density")
> plot(log(1:100), dlunif(log(1:100), log(1), log(10)), type="l",
+      main="Loguniform density")
> 
> plot(1:100, plunif(1:100, exp(1), exp(10)), type="l", main="Loguniform cumulative")
> plot(qlunif(ppoints(100), exp(1), exp(10)), type="l", main="Loguniform quantile")
> 
> hist(rlunif(1000, exp(1), exp(10)), main="random loguniform sample")
> hist(log(rlunif(10000, exp(1), exp(10))), main="random loguniform sample")
> hist(log(rlunif(10000, exp(1), exp(10), base=10), base=10), main="random loguniform sample")
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>