blocks: Computes number of observations for each block

Description Usage Arguments Details Value Note Author(s) References See Also

View source: R/blocks.r


In Rufibach and Walther (2010) a new multiscale mode hunting procedure is presented that compares the local test statistics with critical values given by blocks. Blocks are collection of intervals on a given grid that contain roughly the same number of original observations.


blocks(n, m0 = 10, fm = 2)



Number of observations.


Initial parameter that determines the number of observations in one block.


Factor by which m is increased from block to block.


In our block procedure, we only consider a subset \mathcal{I}_{app} of all possible intervals \mathcal{I}_{all} where

\mathcal{I}_{all} = \Bigl\{(j, \ k ) \ : \ 0 ≤ j < k ≤ n+1, \ k - j > 1\Bigr\}.

This subset \mathcal{I}_{app} is computed as follows:

Set d_1, m_1, f_m > 1. Then:

for \ \ r = 1,…,\#blocks

d_r := round(d_1 f_m^{(r-1)/2}), \ m_r := m_1 f_m^{r-1}.

Include (j,k) in \mathcal{I}_{app} if

(a) j, k \in \{1+i d_r, \ i = 0, 1, … \} \ \ (we only consider every d–th observation) and

(b) m_r ≤ k-j-1 ≤ 2m_r-1 \ \ (\mathcal{I}_{jk} contains between m_r and 2m_r - 1 observations)

end \ \ for


b \times 2–matrix, where b is the number of blocks and the columns contain the lower and the upper number of observations that form each block.


The asymptotic results in Rufibach and Walther (2010) are only derived for f_m = 2.


Kaspar Rufibach,,

Guenther Walther,,


Rufibach, K. and Walther, G. (2010). A general criterion for multiscale inference. J. Comput. Graph. Statist., 19, 175–190.

See Also

This function is called by modeHuntingBlock.

modehunt documentation built on May 2, 2019, 3:31 a.m.