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: denreg

Quantlet: pmreg
Description: Estimation of the regression function in a nonparametric regression model using the taut string method.


Usage: z = pmreg(y, thrconst, verbose, extremanr, bandwidth, sigma, localsqueezing, squeezingfactor, tolerance)
y (n x 1) vector of data
thrconst optional (2.5 by default); it specifies the threshold constant.
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 string and its bounds, the estimated regression function (plotted together with the data y), and the schematized "residual" plot in which non-zero values (1 or -1) indicate that the string touches one of the bounds. If, in addition to that, verbose is negative, then after every iteration program stops waiting for a user input.
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.
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).
sigma optional (-1 by default); if positive, then it specifies the variance of the noise, otherwise, the median absolute deviaton is used.
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.
squeezingfactor optional (0.5 by default); it specifies the amount of "string tube" radius reduction after every iteration.
tolerance optional (0.001 by default); it gives the precision to reach.
z.ystr (n x 1) vector containing the estimated regression function
z.sigmastr the variance used for the estimation (if it was not specified as the input parameter, the median absolute deviation is returned).
z.widths (n+1) x 1 vector of the distance between the estimated cdf and its upper bound
nmax the number of local extremes of the string
knotsind the indices of (sorted) observations at which knots are
knotsy the y-coordinates of the string in knots (given by knotsind)

x =(1:2048)/512
sig = 4*sin(x) + normal(dim(x))
z = pmreg(sig, 2.5, 1)

Numerical results are stored in variable z. You will see
three graphs: one with the string and its bounds, one with
the estimate of the regression function plotted against the
residual plot, and the third one indicating where the string
touches the bounds.

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