Description Usage Arguments Details Value Author(s) References Examples
View source: R/graphical_tools_lin.R
This function provides the mode tree.
1 2 |
data |
Sample in which the mode tree is computed. |
bws |
Vector or range of bandwidths. If it is a vector of size two, then it is used a grid of bandwidths between the given values. Default lower bandwidth is twice the distance between the grid points used for estimating the density and upper bandwidth equal to the range of the data. Unless it is specified a vector of size greater than two, the number of bandwidths employed is equal to the second element of |
gridsize |
Number of equally spaced points at which the density is to be estimated (first element) and bandwidths used to compute the mode tree (second element). Default is |
cbw1 |
Number of modes for which the first critical bandwidth is calculated. This is the first bandwidth used to compute the mode tree when |
cbw2 |
Number of modes for which the second critical bandwidth is calculated. This is the last bandwidth used to compute the mode tree when |
display |
Logical, if |
logbw |
Logical, if |
logbw.regulargrid |
Logical, if |
... |
Arguments to be passed to subsequent methods, |
The mode tree for the sample given in data
is computed. For this calculation, a kernel density estimator with Gaussian kernel and bandwidths bws
is used. When it is plotted, it shows with the continuous lines the estimated mode locations at each bandwidth. The horizontal dashed lines indicate the splitting of a mode in more modes.
The NAs will be automatically removed.
A list with class "gtmod"
containing the following components:
locations |
Estimated mode locations for the bandwidths given in the row names. |
range.x |
The data range, employed to represent the mode tree. |
range.bws |
Employed bandwidths to compute the mode tree. |
logbw |
Logical value indicating if the bandwidths are given in the log10 scale. |
sample.size |
The number of non-missing observations in the sample used for obtaining the mode tree. |
call |
The unevaluated expression, which consists of the named function applied to the given arguments. |
Jose Ameijeiras-Alonso, Rosa M. Crujeiras and Alberto Rodríguez-Casal
Minnotte, M. C. and Scott, D. W. (1993). The mode tree: A tool for visualization of nonparametric density features, Journal of Computational and Graphical Statistics, 2, 51–68.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #Mode tree using a grid of bandwidths between 0.2 and 0.5
set.seed(2016)
data=rnorm(50)
modetree(data,bws=c(0.2,0.5))
## Not run:
#Estimated locations of the five modes in the claw of Marron and Wand (1992)
library(nor1mix)
set.seed(2016)
n<-200
data<-nor1mix::rnorMix(n,MW.nm10)
#Mode tree between the critical bandwidths for 1 and 8 modes
modetree(data,cbw1=1,cbw2=8)
abline(v=1.5);abline(v=-1.5)
## End(Not run)
|
Call:
modetree(data = data, bws = c(0.2, 0.5))
n=50. Location values range: -2.791471 2.19422
Number of employed bandwidths: 151. log10 bandwidths scale: FALSE
Bandwidths range: 0.2 0.5
Warning message:
In modetree(data, bws = c(0.2, 0.5)) :
A grid of 'bws' between the given ones were used
Call:
modetree(data = data, cbw1 = 1, cbw2 = 8)
n=200. Location values range: -2.791471 2.19422
Number of employed bandwidths: 151. log10 bandwidths scale: FALSE
Bandwidths range: 0.1172104 0.3068695
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.