# blocks: Computes number of observations for each block In modehunt: Multiscale Analysis for Density Functions

## Description

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.

## Usage

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

## Arguments

 n Number of observations. m0 Initial parameter that determines the number of observations in one block. fm Factor by which m is increased from block to block.

## Details

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

## Value

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.

## Note

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

## Author(s)

Kaspar Rufibach, [email protected],
http://www.kasparrufibach.ch

Guenther Walther, [email protected],
www-stat.stanford.edu/~gwalther

## References

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

This function is called by modeHuntingBlock.