Computes Renyi's entropy (\({}^qH\)) on different classes of numeric matrices using a moving window algorithm.
Renyi(x, window=3, alpha=1, base=exp(1), rasterOut=TRUE,
np=1.0, na.tolerance=, cluster.type="SOCK", debugging=FALSE)
input data may be a matrix, a Spatial Grid Data Frame, a RasterLayer or a list of these objects. In the latter case, only the first element of the list will be considered.
the side of the square moving window, it must be a odd numeric value greater than 1 to ensure that the target pixel is in the centre of the moving window. Default value is 3.
Order of diversity to compute the index. If alpha
is a vector with length greater than 1, then the index will be calculated over x
for each value in the sequence.
a numerical value which defines the base of the logarithm in Renyi's entropy formula. Default value is exp(1).
Boolean, if TRUE output will be in RasterLayer format with x as template.
the number of processes (cores) which will be spawned. Default value is 1.
a numeric value \((0.0-1.0)\) which indicates the proportion of NA values that will be tolerated to calculate Renyi's index in each moving window over x. If the relative proportion of NA's in a moving window is bigger than na.tolerance, then the value of the window will be set as NA, otherwise Rao's index will be calculated considering the non-NA values. Default values is 1.0 (i.e., no tolerance for NA's).
the type of cluster which will be created. The options are "MPI" (calls "makeMPIcluster"), "FORK" and "SOCK" (call "makeCluster"). Default type is "SOCK".
a boolean variable set to FALSE by default. If TRUE, additional messages will be printed. For debugging only.
A list of matrices with length equal to the length of "alpha". If length of "alpha" is 1, then a matrix of dimension dim(x)
.
Renyi's entropy (\({}^qH\)) is calculated on a numerical matrix as \({}^qH = {1\over(1-q)} \ln(\sum_{i=1}^{R} {p^q}_i)\), where q is the considered order of diversity (alpha
), R is the total number of categories (i.e., unique numerical values in the considered numerical matrix) and p is the relative abundance of each category. If q=1, Shannon.R is called to calculate \(H'\) instead of the indefinite \({}^1D\), if \(p > 2*10^9\), then BerkgerParker.R is called to calculate \(log(1/{}^\infty H)\). Renyi's entropy of low order weight more rare numerical categories, whereas values of higher order weight more dominant categories.
R<U+00E9>nyi, A., 1970. Probability Theory. North Holland Publishing Company, Amsterdam.
# NOT RUN {
#Minimal example; compute Renyi's index with alpha 1:5
a <- matrix(c(10,10,10,20,20,20,20,30,30),ncol=3,nrow=3)
renyi <- Renyi(x=a,window=3,alpha=1:5)
# }
Run the code above in your browser using DataLab