Learn R Programming

KScorrect (version 1.4.2)

dlunif: 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))

Value

dlunif gives the density, plunif gives the distribution function, qlunif gives the quantile function, and rlunif

generates random numbers.

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.

Author

Steve Wang scwang@swarthmore.edu

Details

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

See Also

Distributions for other standard distributions

Examples

Run this code
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")

Run the code above in your browser using DataLab