cdf {lmomPi} | R Documentation |
Generic function for cdf...
: probability distribution fitting with L-Moments.
Description
These functions compute value(s) of cumulated probability or SPI-like (normal standardize) index from a sample or time series of x
.
Usage
cdf(
para,
x,
probability_distribution_attrname = "probability_distrib",
indices = NULL,
return.as.spi = FALSE,
spi.scale = NA,
distrib = NA,
...
)
spi.cdf(x, para, ...)
cdf.spi(x, para, ...)
Arguments
x , para , ... |
L-moments and further parameters for |
probability_distribution_attrname |
attribute name for probability distribution |
indices |
vector of string working as factors or indices, e g. the month names or similar. It must be of the same length of |
return.as.spi |
logical parameter. Default is |
spi.scale |
integer value or |
distrib |
character string indicating the probability distribution, it can be used in case |
Value
A vector of cumulated probability value(s) or SPI-like Gaussianized values. It is a list of vectors in case of several probability parametric distribution functions (i.e. para
is a list and length(para)>1
).
See Also
pel
,cdfexp
,cdfgam
,cdfgev
,cdfglo
,
cdfgpa
,cdfgno
,cdfgum
,cdfkap
,cdfln3
,cdfnor
,cdfpe3
,cdfwak
,cdfwei
Examples
# Sample L-moments of Ozone from the airquality data
data(airquality)
lmom <- samlmu(airquality$Ozone,nmom=6)
distrib <- c("exp","gam","gev","glo","gpa","gno","gum","kap",
"ln3","nor","pe3","wak","wei")
para_list <- pel(distrib=distrib,lmom=lmom)
cdf_list <- cdf(para=para_list,x=airquality$Ozone)
cdf_gam <- cdf(para=para_list$gam,x=airquality$Ozone)
cdf_gam2 <- cdf(para=para_list$gam,x=airquality$Ozone,distrib="gam")
if (any(cdf_gam!=cdf_gam2,na.rm=TRUE)) stop("Any possible errors after 0.6.3 package updates!")
## Comparison with the SPI/SPEI algorithms: 'SPEI::spi' ('SPEI' package)
if (requireNamespace("SPEI",quietly = TRUE)) {
library(SPEI)
data(wichita)
distrib_wichita <- 'pe3'
spi.scale <- 1
month_wichita <- sprintf("M%02d",wichita$MONTH)
para_whichita <- pel(x=wichita$PRCP,indices=month_wichita,distrib=distrib_wichita,
spi.scale=spi.scale)
spi_wichita <- spi.cdf(x=wichita$PRCP,indices=month_wichita,para=para_whichita,
spi.scale=spi.scale)
spi_wichita_speipkg <- spi(data=wichita$PRCP,distrib='PearsonIII',scale=spi.scale)
difference <- spi_wichita-spi_wichita_speipkg$fitted
}