Title: | Multiscale Analysis for Density Functions |
---|---|
Description: | Given independent and identically distributed observations X(1), ..., X(n) from a density f, provides five methods to perform a multiscale analysis about f as well as the necessary critical values. The first method, introduced in Duembgen and Walther (2008), provides simultaneous confidence statements for the existence and location of local increases (or decreases) of f, based on all intervals I(all) spanned by any two observations X(j), X(k). The second method approximates the latter approach by using only a subset of I(all) and is therefore computationally much more efficient, but asymptotically equivalent. Omitting the additive correction term Gamma in either method offers another two approaches which are more powerful on small scales and less powerful on large scales, however, not asymptotically minimax optimal anymore. Finally, the block procedure is a compromise between adding Gamma or not, having intermediate power properties. The latter is again asymptotically equivalent to the first and was introduced in Rufibach and Walther (2010). |
Authors: | Kaspar Rufibach <[email protected]> and Guenther Walther <[email protected]> |
Maintainer: | Kaspar Rufibach <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.7 |
Built: | 2025-02-28 04:46:10 UTC |
Source: | https://github.com/cran/modehunt |
Provides five methods and corresponding critical values to perform mode hunting, i.e. to compute multiscale test statistics based on local order statistics and spacings that provide simultaneous confidence statements for the existence and location of local increases and decreases of a density.
Package: | modehunt |
Type: | Package |
Version: | 1.0.7 |
Date: | 2015-07-03 |
License: | GPL (>=2) |
In Duembgen and Walther (2008) a multiscale test statistic based on spacings was introduced. This method provides
simultaneous confidence statements for the existence and location of local increases and decreases of a density.
The procedure guarantees finite–sample significance levels and possesses certain asymptotic optimality
and adaptivity properties. However, since the local test statistics are computed on all intervals in
the set
this latter procedure is computationally very expensive. Furthermore, the correction term employed
by Duembgen and Walther (2008) to prevent the global test statistic to be dominated by the values of the local
test statistics on small scales needs in principle to be re–derived for any new local test statistic, a non–trivial
task in general. In Rufibach and Walther (2010), two new procedures are proposed: One that within the original framework
of Duembgen and Walther (2008) approximates the set
by a specific subset of intervals
that only contains
intervals. It is shown that considering
yields a procedure that is in terms of power asymptotically equivalent to that based
on
, however, computationally much more efficient.
Finally, Rufibach and Walther (2010) propose a block procedure. Here, all intervals under consideration are
grouped into blocks, where each interval in a block contains approximately the same number of original observations.
Critical values are then computed per block. Again, this procedure is basically asymptotically equivalent to the
standard approach proposed in Duembgen and Walther (2008), but again computationally much faster. It further offers
a (finite–sample) tradeoff between employing or omitting the additive correction .
The initial procedure by Duembgen and Walther (2008) is implemented as the function
modeHunting
. The help file to the latter function also contains some more description of the mathematical details.
criticalValuesAll
can be used to compute critical values for this approach and
cvModeAll
contains a table of critical values (with and without correction term) for some
and
.
The corresonding functions and -values for the approximation are made available as
modeHuntingApprox
, criticalValuesApprox
, and cvModeApprox
and for the block method as modeHuntingBlock
, criticalValuesBlock
, and
cvModeBlock
.
Kaspar Rufibach (maintainer), [email protected],
http://www.kasparrufibach.ch
Guenther Walther, [email protected],
www-stat.stanford.edu/~gwalther
Kaspar Rufibach acknowledges support by the Swiss National Science Foundation SNF, http://www.snf.ch.
Guenther Walther acknowledges support by NSF grants DMS-9875598, DMS-0505682, and NIH grant 5R33HL068522.
Duembgen, L. and Walther, G. (2008). Multiscale Inference about a density. Ann. Statist., 36, 1758–1785.
Rufibach, K. and Walther, G. (2010). A general criterion for multiscale inference. J. Comput. Graph. Statist., 19, 175–190.
## generate random sample set.seed(1977) n <- 200; a <- 0; b <- 0.5; s <- 2 / (b - a) X.raw <- rlin(n, a, b, s) ## input critical values alpha <- 0.05 data(cvModeAll); data(cvModeApprox); data(cvModeBlock) cv.all <- cvModeAll[cvModeAll$alpha == alpha & cvModeAll$n == n, 3:4] cv.approx <- cvModeApprox[cvModeApprox$alpha == alpha & cvModeApprox$n == n, 3:4] cv.block <- cvModeBlock[cvModeBlock$alpha == alpha & cvModeBlock$n == n, 3:11] ## standard procedure from Duembgen and Walther (2008) mod1 <- modeHunting(X.raw, lower = 0, upper = 1, cv.all, min.int = TRUE) ## procedure from Rufibach and Walther (2010) based on I_app mod2 <- modeHuntingApprox(X.raw, lower = 0, upper = 1, crit.vals = cv.approx, min.int = TRUE) ## block procedure from Rufibach and Walther (2010) mod3 <- modeHuntingBlock(X.raw, lower = 0, upper = 1, crit.vals = cv.block, min.int = TRUE) ## display mod1; mod2; mod3
## generate random sample set.seed(1977) n <- 200; a <- 0; b <- 0.5; s <- 2 / (b - a) X.raw <- rlin(n, a, b, s) ## input critical values alpha <- 0.05 data(cvModeAll); data(cvModeApprox); data(cvModeBlock) cv.all <- cvModeAll[cvModeAll$alpha == alpha & cvModeAll$n == n, 3:4] cv.approx <- cvModeApprox[cvModeApprox$alpha == alpha & cvModeApprox$n == n, 3:4] cv.block <- cvModeBlock[cvModeBlock$alpha == alpha & cvModeBlock$n == n, 3:11] ## standard procedure from Duembgen and Walther (2008) mod1 <- modeHunting(X.raw, lower = 0, upper = 1, cv.all, min.int = TRUE) ## procedure from Rufibach and Walther (2010) based on I_app mod2 <- modeHuntingApprox(X.raw, lower = 0, upper = 1, crit.vals = cv.approx, min.int = TRUE) ## block procedure from Rufibach and Walther (2010) mod3 <- modeHuntingBlock(X.raw, lower = 0, upper = 1, crit.vals = cv.block, min.int = TRUE) ## display mod1; mod2; mod3
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)
blocks(n, m0 = 10, fm = 2)
n |
Number of observations. |
m0 |
Initial parameter that determines the number of observations in one block. |
fm |
Factor by which |
In our block procedure, we only consider a subset of all possible intervals
where
This subset is computed as follows:
Set . Then:
Include in
if
(a) \ \ (we only consider every
–th observation) and
(b) \ \ (
contains between
and
observations)
–matrix, where
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 .
Kaspar Rufibach, [email protected],
http://www.kasparrufibach.ch
Guenther Walther, [email protected],
www-stat.stanford.edu/~gwalther
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
.
This function computes critical values that are needed to perform the multiscale analysis about a
density using the function modeHunting
.
criticalValuesAll(n, alpha, M, display, path)
criticalValuesAll(n, alpha, M, display, path)
n |
Number of observations. |
alpha |
Significance level, real number in |
M |
Number of runs to perform. |
display |
If |
path |
If |
For more details see the function modeHunting
and the data set cvModeAll
.
A 2-dimensional vector containing the critical value for the test statistic with or without additive
correction .
Kaspar Rufibach, [email protected],
http://www.kasparrufibach.ch
Guenther Walther, [email protected],
www-stat.stanford.edu/~gwalther
Rufibach, K. and Walther, G. (2010). A general criterion for multiscale inference. J. Comput. Graph. Statist., 19, 175–190.
The resulting critical values can be used by the function modeHunting
. Critical values
for some combinations of and
are available in
cvModeAll
.
## compute critical values and compare to those in cvModeAll ## (to see output in R, press CTRL + W) cv1 <- criticalValuesAll(n = 200, alpha = 0.05, M = 10 ^ 2, display = 1, path = NA) data(cvModeAll) cv2 <- cvModeAll[cvModeAll$alpha == 0.05 & cvModeAll$n == 200, 3:4] rbind(cv1, cv2)
## compute critical values and compare to those in cvModeAll ## (to see output in R, press CTRL + W) cv1 <- criticalValuesAll(n = 200, alpha = 0.05, M = 10 ^ 2, display = 1, path = NA) data(cvModeAll) cv2 <- cvModeAll[cvModeAll$alpha == 0.05 & cvModeAll$n == 200, 3:4] rbind(cv1, cv2)
This function computes critical values that can be used to perform the multiscale analysis about a
density with the functions modeHuntingApprox
and modeHuntingBlock
.
criticalValuesApprox(n, d0 = 2, m0 = 10, fm = 2, alpha = 0.05, gam = 2, tail = 10, M = 10 ^ 5, display = 0, path = NA)
criticalValuesApprox(n, d0 = 2, m0 = 10, fm = 2, alpha = 0.05, gam = 2, tail = 10, M = 10 ^ 5, display = 0, path = NA)
n |
Number of observations. |
d0 |
Initial parameter for the grid resolution. |
m0 |
Initial parameter for the number of observations in one block. |
fm |
Factor by which |
alpha |
Significance level, real number in |
gam |
Weighting exponent for level in each block. |
tail |
Offset, determines together with |
M |
Number of runs to perform. |
display |
If |
path |
If |
For details see the function modeHuntingApprox
and the data set cvModeApprox
.
approx |
A 2-dimensional vector containing the critical value for the test statistic with or without
additive correction |
block |
A vector containing the critical value for each block. |
The asymptotic results in Rufibach and Walther (2010) are only derived for .
Kaspar Rufibach, [email protected],
http://www.kasparrufibach.ch
Guenther Walther, [email protected],
www-stat.stanford.edu/~gwalther
Rufibach, K. and Walther, G. (2010). A general criterion for multiscale inference. J. Comput. Graph. Statist., 19, 175–190.
The resulting critical values are used by the functions modeHuntingApprox
and modeHuntingBlock
. Critical values
for some combinations of and
are available in
cvModeApprox
and
cvModeBlock
.
## compute critical values and compare to those in cvModeAll and cvModeBlock ## (to see output in R, press CTRL + W) cv <- criticalValuesApprox(n = 200, d0 = 2, m0 = 10, fm = 2, alpha = 0.05, gam = 2, tail = 10, M = 10 ^ 2, display = 1, path = NA) cv1 <- cv$approx; cv2 <- cv$block data(cvModeApprox); data(cvModeBlock) cv3 <- cvModeApprox[cvModeApprox$alpha == 0.05 & cvModeApprox$n == 200, 3:4] cv4 <- cvModeBlock[cvModeBlock$alpha == 0.05 & cvModeBlock$n == 200, 3:6] rbind(cv1, cv3) rbind(cv2, cv4)
## compute critical values and compare to those in cvModeAll and cvModeBlock ## (to see output in R, press CTRL + W) cv <- criticalValuesApprox(n = 200, d0 = 2, m0 = 10, fm = 2, alpha = 0.05, gam = 2, tail = 10, M = 10 ^ 2, display = 1, path = NA) cv1 <- cv$approx; cv2 <- cv$block data(cvModeApprox); data(cvModeBlock) cv3 <- cvModeApprox[cvModeApprox$alpha == 0.05 & cvModeApprox$n == 200, 3:4] cv4 <- cvModeBlock[cvModeBlock$alpha == 0.05 & cvModeBlock$n == 200, 3:6] rbind(cv1, cv3) rbind(cv2, cv4)
This dataset contains critical values for some and
for the test statistic based on
all intervals, with or without additive correction term
.
data(cvModeAll)
data(cvModeAll)
A data frame providing 15 different combinations of and
and the following columns:
alpha |
The levels at which critical values were simulated. |
n |
The number of observations for which critical values were simulated. |
withadd |
Critical values based on and the set of all intervals . |
noadd |
Critical values based on and the set of all intervals .
|
For details on the above test statistics see modeHunting
. Critical values are based on
simulations of i.i.d. random vectors
where is a uniformly on
distributed random variable,
.
is the number of interior observations, i.e. if you are analyzing a sample of size
, then you need critical values corresponding to
n = m-2 |
If no additional information on and is available. |
n = m-1 |
If either or is known to be a certain finite number. |
n = m |
If both and are known to be certain finite numbers,
|
where is the support of
.
These critical values were generated using the function criticalValuesAll
. Critical values
for other combinations for and
can be computed using this latter function.
Rufibach, K. and Walther, G. (2010). A general criterion for multiscale inference. J. Comput. Graph. Statist., 19, 175–190.
## extract critical values for alpha = 0.05, n = 200 data(cvModeAll) cv <- cvModeAll[cvModeAll$alpha == 0.05 & cvModeAll$n == 200, 3:4] cv
## extract critical values for alpha = 0.05, n = 200 data(cvModeAll) cv <- cvModeAll[cvModeAll$alpha == 0.05 & cvModeAll$n == 200, 3:4] cv
This dataset contains critical values for some and
for the test statistic based on
the approximating set of intervals, with or without additive correction term
.
data(cvModeApprox)
data(cvModeApprox)
A data frame providing 15 different combinations of and
and the following columns:
alpha |
The levels at which critical values were simulated. |
n |
The number of observations for which critical values were simulated. |
withadd |
Critical values based on and the approximating set of intervals . |
noadd |
Critical values based on and the approximating set of intervals .
|
For details see modeHunting
. Critical values are based on
simulations of i.i.d. random vectors
where is a uniformly on
distributed random variable,
.
is the number of interior observations, i.e. if you are analyzing a sample of size
, then you need critical values corresponding to
n = m-2 |
If no additional information on and is available. |
n = m-1 |
If either or is known to be a certain finite number. |
n = m |
If both and are known to be certain finite numbers,
|
where is the support of
.
These critical values were generated using the function criticalValuesApprox
. Critical values
for other combinations for and
can be computed using this latter function.
Rufibach, K. and Walther, G. (2010). A general criterion for multiscale inference. J. Comput. Graph. Statist., 19, 175–190.
## extract critical values for alpha = 0.05, n = 200 data(cvModeApprox) cv <- cvModeApprox[cvModeApprox$alpha == 0.05 & cvModeApprox$n == 200, 3:4] cv
## extract critical values for alpha = 0.05, n = 200 data(cvModeApprox) cv <- cvModeApprox[cvModeApprox$alpha == 0.05 & cvModeApprox$n == 200, 3:4] cv
This dataset contains critical values for some and
for the block procedure.
data(cvModeBlock)
data(cvModeBlock)
A data frame providing 15 different combinations of and
and the following columns:
alpha |
The levels at which critical values were simulated. |
n |
The number of observations for which critical values were simulated. |
block 1 - 9 |
Critical values for the respective blocks. |
For details see modeHunting
. Critical values are based on
simulations of i.i.d. random vectors
where is a uniformly on
distributed random variable,
.
is the number of interior observations, i.e. if you are analyzing a sample of size
, then you need critical values corresponding to
n = m-2 |
If no additional information on and is available. |
n = m-1 |
If either or is known to be a certain finite number. |
n = m |
If both and are known to be certain finite numbers,
|
where is the support of
.
These critical values were generated using the function criticalValuesBlock
. Critical values
for other combinations for and
can be computed using this latter function.
Rufibach, K. and Walther, G. (2010). A general criterion for multiscale inference. J. Comput. Graph. Statist., 19, 175–190.
## extract critical values for alpha = 0.05, n = 200 data(cvModeBlock) cv <- cvModeBlock[cvModeBlock$alpha == 0.05 & cvModeBlock$n == 200, 3:11] cv
## extract critical values for alpha = 0.05, n = 200 data(cvModeBlock) cv <- cvModeBlock[cvModeBlock$alpha == 0.05 & cvModeBlock$n == 200, 3:11] cv
Density function, distribution function, quantile function and
random generation for the perturbed uniform distribution having a linear increase of slope
on an interval
.
dlin(x, a, b, s) plin(q, a, b, s) qlin(p, a, b, s) rlin(n, a, b, s)
dlin(x, a, b, s) plin(q, a, b, s) qlin(p, a, b, s) rlin(n, a, b, s)
x , q
|
Vector of quantiles. |
p |
Vector of probabilities. |
n |
Number of observations. |
a |
Left interval endpoint, real number in |
b |
Right interval endpoint, real number in |
s |
Slope parameter, real number such that |
The what we call perturbed uniform distribution (PUD) with perturbation on an
interval with slope parameter
such that
has density function
distribution function
and quantile function
This function was used to carry out the simulations to compute the power curves given in Rufibach and Walther (2010).
dlin
gives the values of the density function, plin
those of the distribution
function, and qlin
those of the quantile function of the PUD at and
,
respectively.
rlin
generates random numbers, returned as an ordered vector.
Kaspar Rufibach, [email protected],
http://www.kasparrufibach.ch
Guenther Walther, [email protected],
www-stat.stanford.edu/~gwalther
Rufibach, K. and Walther, G. (2010). A general criterion for multiscale inference. J. Comput. Graph. Statist., 19, 175–190.
In general, all intervals that have a test statistic bigger than the respective critical value
are output. For a given set of intervals , all intervals
such that
does not contain a proper subset of
are called minimal. Given
, this function
computes the set of minimal intervals.
minimalIntervals(ints)
minimalIntervals(ints)
ints |
Either one of the sets |
Returns the set of minimal elements , corresponding to the set of input intervals
.
Depending on the value of , this function is called by
modeHunting
, modeHuntingApprox
, and modeHuntingBlock
.
Kaspar Rufibach, [email protected],
http://www.kasparrufibach.ch
Guenther Walther, [email protected],
www-stat.stanford.edu/~gwalther
Minimal intervals were first introduced (although for a different multiscale procedure) on p. 517 in
Lutz Dümbgen (2002). Application of Local Rank Tests to Nonparametric Regression. Journal of Nonparametric Statistics, 14, 511–537.
Rufibach, K. and Walther, G. (2010). A general criterion for multiscale inference. J. Comput. Graph. Statist., 19, 175–190.
Simultanous confidence statements for the existence and location of local increases and decreases of a density f, computed on all intervals spanned by two observations.
modeHunting(X.raw, lower = -Inf, upper = Inf, crit.vals, min.int = FALSE)
modeHunting(X.raw, lower = -Inf, upper = Inf, crit.vals, min.int = FALSE)
X.raw |
Vector of observations. |
lower |
Lower support point of |
upper |
Upper support point of |
crit.vals |
2-dimensional vector giving the critical values for the desired level. |
min.int |
If |
In general, the methods modeHunting
, modeHuntingApprox
, and
modeHuntingBlock
compute for a given level and the corresponding
critical value
two sets of intervals
where for
and
are
appropriate critical values.
Specifically, the function modeHunting
computes based on the two
test statistics
and
using the set of all intervals spanned by two observations
:
We introduced the local test statistics
for local order statistics
the standard deviation and the additive correction term
for
.
If min.int = TRUE
, the set is replaced by the set
of its minimal elements. An interval
is called minimal if
contains no proper subset of
. This minimization post-processing
step typically massively reduces the number of intervals. If we are mainly interested in locating the ranges
of increases and decreases of
as precisely as possible, the intervals in
do not contain relevant information.
Dp |
The set |
Dm |
The set |
Dp.noadd |
The set |
Dm.noadd |
The set |
Critical values for modeHunting
and some combinations of and
are provided in the
data set
cvModeAll
. Critical values for other values of and
can be generated
using
criticalValuesAll
.
Parts of this function were derived from MatLab code provided on Lutz Duembgen's webpage,
http://www.staff.unibe.ch/duembgen.
Kaspar Rufibach, [email protected],
http://www.kasparrufibach.ch
Guenther Walther, [email protected],
www-stat.stanford.edu/~gwalther
Duembgen, L. and Walther, G. (2008). Multiscale Inference about a density. Ann. Statist., 36, 1758–1785.
Rufibach, K. and Walther, G. (2010). A general criterion for multiscale inference. J. Comput. Graph. Statist., 19, 175–190.
modeHuntingApprox
, modeHuntingBlock
, and cvModeAll
.
## for examples type help("mode hunting") ## and check the examples there
## for examples type help("mode hunting") ## and check the examples there
Simultanous confidence statements for the existence and location of local increases and decreases of a density f, computed on the approximating set of intervals.
modeHuntingApprox(X.raw, lower = -Inf, upper = Inf, d0 = 2, m0 = 10, fm = 2, crit.vals, min.int = FALSE)
modeHuntingApprox(X.raw, lower = -Inf, upper = Inf, d0 = 2, m0 = 10, fm = 2, crit.vals, min.int = FALSE)
X.raw |
Vector of observations. |
lower |
Lower support point of |
upper |
Upper support point of |
d0 |
Initial parameter for the grid resolution. |
m0 |
Initial parameter for the number of observations in one block. |
fm |
Factor by which |
crit.vals |
2-dimensional vector giving the critical values for the desired level. |
min.int |
If |
See blocks
for details how is generated and
modeHunting
for
a proper introduction to the notation used here.
The function modeHuntingApprox
computes based on the two
test statistics
and
.
If min.int = TRUE
, the set is replaced by the set
of its minimal elements. An interval
is called minimal if
contains no proper subset of
. This minimization post-processing
step typically massively reduces the number of intervals. If we are mainly interested in locating the ranges
of increases and decreases of
as precisely as possible, the intervals in
do not contain relevant information.
Dp |
The set |
Dm |
The set |
Dp.noadd |
The set |
Dm.noadd |
The set |
Critical values for modeHuntingApprox
and some combinations of and
are
provided in the data set
cvModeApprox
. Critical values for other
values of and
can be generated using
criticalValuesApprox
.
Kaspar Rufibach, [email protected],
http://www.kasparrufibach.ch
Guenther Walther, [email protected],
www-stat.stanford.edu/~gwalther
Duembgen, L. and Walther, G. (2008). Multiscale Inference about a density. Ann. Statist., 36, 1758–1785.
Rufibach, K. and Walther, G. (2010). A general criterion for multiscale inference. J. Comput. Graph. Statist., 19, 175–190.
modeHunting
, modeHuntingBlock
, and cvModeApprox
.
## for examples type help("mode hunting") ## and check the examples there
## for examples type help("mode hunting") ## and check the examples there
Simultanous confidence statements for the existence and location of local increases and decreases of a density f, computed via the block procedure.
modeHuntingBlock(X.raw, lower = -Inf, upper = Inf, d0 = 2, m0 = 10, fm = 2, crit.vals, min.int = FALSE)
modeHuntingBlock(X.raw, lower = -Inf, upper = Inf, d0 = 2, m0 = 10, fm = 2, crit.vals, min.int = FALSE)
X.raw |
Vector of observations. |
lower |
Lower support point of |
upper |
Upper support point of |
d0 |
Initial parameter for the grid resolution. |
m0 |
Initial parameter for the number of observations in one block. |
fm |
Factor by which |
crit.vals |
2-dimensional vector giving the critical values for the desired level. |
min.int |
If |
See blocks
for details how is generated and
modeHunting
for
a proper introduction to the notation used here.
The function modeHuntingBlock
uses the test statistic ,
where
contains all intervals of Block
,
.
Critical values for each block individually are received via finding an
such that
where is the
–quantile of the distribution of
We then define the sets
as
Note that and
are automatically determined by
.
If min.int = TRUE
, the set is replaced by the set
of its minimal elements. An interval
is called minimal if
contains no proper subset of
. This minimization post-processing
step typically massively reduces the number of intervals. If we are mainly interested in locating the ranges
of increases and decreases of
as precisely as possible, the intervals in
do not contain relevant information.
Dp |
The set |
Dm |
The set |
Critical values for some combinations of and
are provided in the
data sets
cvModeBlock
. Critical values for other
values of and
can be generated using
criticalValuesApprox
.
Kaspar Rufibach, [email protected],
http://www.kasparrufibach.ch
Guenther Walther, [email protected],
www-stat.stanford.edu/~gwalther
Duembgen, L. and Walther, G. (2008). Multiscale Inference about a density. Ann. Statist., 36, 1758–1785.
Rufibach, K. and Walther, G. (2010). A general criterion for multiscale inference. J. Comput. Graph. Statist., 19, 175–190.
modeHunting
, modeHuntingApprox
, and cvModeBlock
.
## for examples type help("mode hunting") ## and check the examples there
## for examples type help("mode hunting") ## and check the examples there
The built-in R function round
rounds a 5 to the even digit. Instead, we preferred
the more intuitive rounding meaning that a 5 is always rounded to the next higher digit.
myRound(d)
myRound(d)
d |
Real number. |
The biggest integer not bigger than if
and the smallest integer greater than
if
.
Kaspar Rufibach, [email protected],
http://www.kasparrufibach.ch
Guenther Walther, [email protected],
www-stat.stanford.edu/~gwalther
The built-in R function round
.
x <- c(1.5, 2.5) ## built in R function round(x) ## [1] 2 2 ## this function myRound(x) ## [1] 2 3
x <- c(1.5, 2.5) ## built in R function round(x) ## [1] 2 2 ## this function myRound(x) ## [1] 2 3
Preprocesses the initial data vector X.raw according to whether the upper and/or lower endpoint of the support of f is known.
preProcessX(X.raw, lower = -Inf, upper = Inf)
preProcessX(X.raw, lower = -Inf, upper = Inf)
X.raw |
Vector of observations. |
lower |
Lower support point of |
upper |
Upper support point of |
Depending whether and
are known, the vector of raw observations
is supplemented by
and/or
and finally sorted.
Sorted vector of (processed) observations.
This function is called by modeHunting
, modeHuntingApprox
,
and modeHuntingBlock
.
This function was derived from MatLab code provided on Lutz Duembgen's webpage,
http://www.staff.unibe.ch/duembgen.
Kaspar Rufibach, [email protected],
http://www.kasparrufibach.ch
Guenther Walther, [email protected],
www-stat.stanford.edu/~gwalther