This function provides the SiZer map.
sizer(data,method=2,bws=NULL,gridsize=NULL,alpha=0.05,B=NULL,n0=NULL,
cbw1=NULL,cbw2=NULL,display=TRUE,logbw=TRUE,from=NULL,to=NULL,col.sizer=NULL,
xlab=NULL,ylab=NULL,addlegend=TRUE,poslegend="topright")
Sample in which the SiZer map is computed.
The method employed for computing the SiZer map. Available methods are: 1 (q1, pointwise Gaussian quantiles), 2 (q2, approximate simultaneous over x Gaussian quantiles), 3 (q3, bootstrap quantile simultaneous over x) and 4 (q4, bootstrap quantile simultaneous over x and h). Default method=2
.
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 grid size 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 grid points in the horizontal (values of the variable, first element) and vertical (bandwidths, second element) axis. Default is c(512,151)
.
Significance level employed for determining the significant features. Default alpha=0.05
.
Number of replicates used for generating the SiZer map when method q3 or q4 are used. Default B=100
.
When the effective sample size is below this quantity, the pixel in the SiZer map is shaded grey. Default n0=5
.
Number of modes for which the first critical bandwidth is calculated. This is the first bandwidth used to compute the SiZer map when bws
is not specified.
Number of modes for which the second critical bandwidth is calculated. This is the last bandwidth used to compute the SiZer map when bws
is not specified.
Logical, if TRUE
the SiZer map is plotted. Default TRUE
.
Logical, if TRUE
the plot displays and returns the log10 bandwidths. Default logbw=FALSE
.
First plotted value of the variable. Default is below the data minimum.
Last plotted value of the variable. Default is above the data maximum.
Colors employed in the SiZer map. The first color indicates where the smoothed curve is significantly increasing, the second where it is not significantly different from zero, the third where it is significantly negative and the forth where the data are too sparse for meaningful inference. Default col.sizer=c("red","orchid","blue","grey")
.
A title for the x axis. See title
.
A title for the y axis. See title
.
Logical, if TRUE
the legend is displayed. Default TRUE
.
Position where the legend should be displayed. Default posLegend="topright"
.
Matrix indicating the significant behavior of the smoothed curve in each location-bandwidth pixel. One indicates significantly decreasing; two, not significantly different from zero; three, significantly increasing and four where the data are too sparse for meaningful inference.
Matrix containig the lower limit of the confidence interval in each location-bandwidth pixel.
Matrix containing the derivative values of the kernel density estimation in each location-bandwidth pixel.
Matrix containig the upper limit of the confidence interval in each location-bandwidth pixel.
Matrix containing the Effective Sample Size in each location-bandwidth pixel.
Employed location values to represent the mode forest.
Employed bandwidths to compute the different mode trees.
With this function the assessment of SIgnificant ZERo crossing of the derivative of the smoothed curve are computed for the sample given in data
. For this calculation, a kernel density estimator with Gaussian kernel and bandwidths bws
is used. At a given location (horizontal axis) and using a specified bandwidth parameter (vertical axis), the SiZer map represents where the curve is significantly increasing (blue color by default), decreasing (red by default) or not significantly different from zero (orchid, a light tone of purple, by default). Thus, for a given bandwidth, a region significantly increasing followed by a region significantly decreasing (blue-red pattern by default) indicates where there is a significant peak.
For methods q2, q3 and q4, it is calculated where the data are too sparse for meaningful inference (grey color by default). A location-bandwidth pixel is classified in this last category when the estimated Effective Sample Size is less than n0
. For more information, see Chaudhuri and Marron (1999).
For methods q3 and q4, the bootstrap quantiles are computed generating B
random samples drawn with replacement from data
.
The NAs will be automatically removed.
Chaudhuri, P. and Marron, J. S. (1999). SiZer for exploration of structures in curves, Journal of the American Statistical Association, 94, 807--823.
# NOT RUN {
#SiZer map using a grid of bandwidths between 1 and 10
data(geyser)
data=geyser
sizer(data,bws=c(1,10))
# }
# NOT RUN {
#Different methods for calculating the confidence limits
#Pointwise Gaussian quantiles
sizer(data,method=1,bws=c(1,10))
#Approximate simultaneous over x Gaussian quantiles
sizer(data,method=2,bws=c(1,10))
#Bootstrap quantile simultaneous over x
sizer(data,method=3,bws=c(1,10))
#Bootstrap quantile simultaneous over x and h
sizer(data,method=4,bws=c(1,10))
# }
# NOT RUN {
#Adding the original mode tree for this sample
modetree(data,bws=c(0.8,10),logbw=TRUE,addplot=TRUE,col.lines="white")
# }
Run the code above in your browser using DataLab