Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: smoother
See also: pmreg

Quantlet: denreg
Description: Probability density estimation for the noise in a nonparametric regression model using the taut string method.


Usage: z = denreg(x, verbose, localsqueezing, bandwidth, squeezingfactor, extremanr, tolerance)
x (n x 1) vector of data
verbose optional (it is zero by default); if non-zero, the user is in every iteration and at the end of the computation presented with three graphs characterizing the approximation (histogram, cumulative probability function, distance of string to bounds). If, in addition to that, verbose is negative, then after every iteration program stops waiting for a user input.
localsqueezing optional (one by default); if non-zero, a local squeezing is used, that is the reduction of the radius of "string tube" takes place only in neighborhoods of local extremes.
bandwidth optional (-1 by default); if positive, then it specifies the bandwidth for "string tube" to be used, otherwise, a predefined bandwidth is chosen (depending on the size of the data and other parameters).
squeezingfactor optional (0.5 by default); it specifies the amount of "string tube" radius reduction after every iteration.
extremanr optional (-1 by default); if positive, it prescribes the maximum for the number of local extrema. It can be used only if local squeezing is not active.
tolerance optional (0.001 by default); it gives the precision to reach.
z.y (n+1) x 1 vector of the density estimate
z.widths (n+2) x 1 vector of the distance of the string and the tube
z.nmax the number of local extremes of the string
z.ind the indices of (sorted) observations at which knots are
z.trans (n+2) x 1 vector of the cumulative distribution function

x =(0:2000)/500
sig = 4*sin(x) + normal(dim(x))
z = denreg(sig, 1)

Numerical results are stored in variable z. You will see
three graphs: one with a histogram and the estimated density,
an approximation of the cumulative distribution function together
with the bounds (given by bandwidth), and the third one
containing the distance of the estimate from the bounds.

Author: P. Cizek, 20001124
(C) MD*TECH Method and Data Technologies, 05.02.2006