shape, scale: Shape and scale of the Fréchet distribution, defaults to 1.5 and 0.5 respectively.
log, log.p: logical; if TRUE, probabilities p are given as log(p).
lower.tail: logical; if TRUE (default), probabilities (moments) are P[X≤x](E[xr∣X≤y]), otherwise, P[X>x](E[xr∣X>y])
p: vector of probabilities
r: rth raw moment of the distribution
truncation: lower truncation parameter
n: number of observations
Returns
dfrechet returns the density, pfrechet the distribution function, qfrechet the quantile function, mfrechet the rth moment of the distribution and rfrechet generates random deviates.
The length of the result is determined by n for rfrechet, and is the maximum of the lengths of the numerical arguments for the other functions.
## Frechet densityplot(x = seq(0,5, length.out =100), y = dfrechet(x = seq(0,5, length.out =100),shape =1, scale =1))plot(x = seq(0,5, length.out =100), y = dfrechet(x = seq(0,5, length.out =100),shape =2, scale =1))plot(x = seq(0,5, length.out =100), y = dfrechet(x = seq(0,5, length.out =100),shape =3, scale =1))plot(x = seq(0,5, length.out =100), y = dfrechet(x = seq(0,5, length.out =100),shape =3, scale =2))## frechet is also called the inverse weibull distribution, which is available in the stats packagepfrechet(q =5, shape =2, scale =1.5)1- pweibull(q =1/5, shape =2, scale =1/1.5)## Demonstration of log functionality for probability and quantile functionqfrechet(pfrechet(2, log.p =TRUE), log.p =TRUE)## The zeroth truncated moment is equivalent to the probability functionpfrechet(2)mfrechet(truncation =2)## The (truncated) first moment is equivalent to the mean of a (truncated) random sample,#for large enough samples.x <- rfrechet(1e5, scale =1)mean(x)mfrechet(r =1, lower.tail =FALSE, scale =1)sum(x[x > quantile(x,0.1)])/ length(x)mfrechet(r =1, truncation = quantile(x,0.1), lower.tail =FALSE, scale =1)