minmaxBlock | R Documentation |
2 \times 2
(non-zero) matrix of missing valuesFinds 2 \times 2
(non-zero) block with the minimum or maximum
amount of missing values within a general missing values matrix derived from
satellite images.
minmaxBlock(sieve, type = c("min", "max"), rank)
sieve |
matrix |
type |
character. Default is |
rank |
numeric. See Details. |
In what follows we describe the case type="min"
. This function searches for the
minimal 2\times 2
(non-zero) sub-matrix within a general sieve
matrix.
blockMissingness is defined as \log( cumsum (a_{i,j}) )
for 1\leq i,j\leq 2
.
The minimal block is defined as that block with the minimum blockMissingness. The cumsum
function
is preferred rather than other quantities, such as cumprod
or det
, because sieve
could have a large amount of zeros.
In the first stage of the search, a vector with the sorted non-zero
values of sieve
is calculated. Consider the i
-th entry of this sorted
vector. This value corresponds to some (maybe more than once) cell within sieve
.
Notice that, with the exception of the edges of the sieve, this cell belongs to four 2\times 2
matrices. The blockMissingness
of each of these 4 matrices is calculated. The matrix with the smallest blockMissingness
is called a localMinBlock.
The procedure just described is applied to each of the rank
entries of the
sorted vector; the globalMinBlock is that localMinBlock with the
smallest blockMissingness.
The case type="max"
is analogous to the one above but the searches is now for the cell with
the largest blockMissingness and the search now runs (in descending order) over the last rank
-th entries
of the sorted vector.
The argument rank
is defined as follows. Let sorted_vector
be a numeric vector
with the non-zero, ordered (in ascending order) values of sieve
. When type="min"
,
rank
defines the first rank
-th values of sorted_vector
. When type="max"
,
rank
defines the last rank
-th values of sorted_vector
.
A list containing:
rows |
a numeric vector given the rows of |
cols |
a numeric vector given the cols of |
block |
a |
blockMissingness |
a numeric with the blockMissingness of the minimal block. |
mvSieve
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.