Statistics - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Statistics and Data Analysis : Statistics Package : Regression : Statistics/Lowess

Statistics

  

Lowess

  

produce lowess smoothed functions

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Lowess(XY, options)

Lowess(X, Y, options)

L := Lowess(...)

L(x1, x2, ..., xN)

L(M)

Parameters

XY

-

Matrix, Array, or listlist of data convertible to numeric. If XY is a Matrix or Array, it must have at least two columns. If XY is a listlist, then each inner list is considered one row, with the kth of each inner list being the elements of the kth column, and the same requirement of at least two columns applies. Each row of XY is interpreted as one data point. If XY has m columns, then the first m1 columns contain the values of the m1 independent variables. The last column contains the corresponding values of the dependent variable.

X

-

Vector, list, Matrix, Array, or listlist of data convertible to numeric with the number of rows equal to the length of Y. The columns are interpreted as the values of the independent variables.

Y

-

Vector, list, or Array of data convertible to numeric with length equal to the number of rows in X. The values in Y are the corresponding values of the dependent variable.

options

-

(optional) equation(s) of the form option=value where option is one of fitorder, bandwidth, or iters

x1, x2, ..., xN

-

evaluates L at (x1, x2, ..., xN), where N is equal to m1 or the number of columns in X.

M

-

a matrix with number of columns equal to the number of columns in X or m1. Returns a Vector where the ith element is L evaluated with the ith row of M as arguments

Options

• 

fitorder=nonnegint

  

The degree of the polynomial used in each local regression. The default value is 1.

• 

bandwidth=Range(0, 1)

  

The proportion of the input data points used in each local regression. The default value depends on fitorder and the number of input data points.

• 

iters=nonnegint

  

The number of iterations when smoothing data of one independent variable. Each iteration makes the data smoother by eliminating outliers, thus making the computation more robust. This option has no effect when the data has more than one independent variable. The default is 2.

Description

• 

The Lowess command creates a function whose values represent the input data smoothed with the lowess algorithm.

• 

Suppose the input data set XY is of m independent variables and has n data points, the lowess smoothed value at xx1,x2,,xm is computed as follows.

– 

Take the nbandwidth points in XY that are closest to x.

– 

Fit a polynomial P of m variables and degree fitorder to the points using weighted linear least squares, where the weight for a point w is computed by applying the tri-cube weight function to the distance between x and w.

– 

Evaluate Px.

• 

Running one or more iterations, as specified by the iters option, will produce a set of weights to reduce the influence of outliers (that is, make the computation more robust). At each iteration, the weight of a point depends on the residual of the Lowess curve at that point in the previous iteration. These weights are combined with the weights given by the distance, as described previously.

• 

L will return unevaluated if the arguments are non-convertible to numerics. But if the first and only argument is a Matrix with number of columns equal to the number of parameters of L, a Vector will be returned where the ith element is the L applied with the ith row of the Matrix as arguments.

Examples

withStatistics:

Create a data sample and apply to it some error.

XSampleUniform2,2,200:

YSampleUniform2,2,200:

ZerrorSampleNormal0,0.1,200:

Z`~`[:-`*`]X,` $`,mapexp,`~`[:-`^`]X,` $`,2`~`[:-`^`]Y,` $`,2+Zerror:

XYZMatrixX,Y,Z,datatype=float[8]%T

XYZ 200 x 3 MatrixData Type: float[8]Storage: rectangularOrder: Fortran_order

(1)

Create the function whose graph is the smoothed surface.

LLowessXYZ,fitorder=2,bandwidth=0.3:

Plot the data sample, smoothed surface, and the region between the plane z=0.4 and the surface for -1.5x0.5 and -1y1.

PScatterPlot3DXYZ:

Qplot3dL,2..2,2..2,grid=25,25:

Rplots:-shadebetweenLx,y,0.4,x=1.5..0.5,y=1..1,showboundary=false,negativeonly:

plots:-displayP,Q,R,orientation=100,70,0,lightmodel=none

Find the volume of the shaded region.

int0.4Lx,y,x=1.5..0.5,y=1..1,numeric,ε=0.01,method=_CubaSuave

1.30321733303695

(2)

For a two dimensional example we will create another data sample.

XSampleUniform0,π,200

X 1 .. 200 Vector[row]Data Type: float[8]Storage: rectangularOrder: Fortran_order

(3)

YerrorSampleNormal0,0.1,200

Yerror 1 .. 200 Vector[row]Data Type: float[8]Storage: rectangularOrder: Fortran_order

(4)

Ymapsin,X+Yerror

Y 1 .. 200 Vector[row]Data Type: float[8]Storage: rectangularOrder: Fortran_order

(5)

Create the function whose graph is the smoothed curve.

LCurveFitting:-LowessX,Y,fitorder=1,bandwidth=0.3:

Plot the data sample, smoothed curve, and the region between the x-axis and the curve for π8x3π8.

PScatterPlotX,Y

P

QplotLx,x=0..π

Q

Rplots:-shadebetweenLx,0,x=π8..3π8,showboundary=false,positiveonly

R

plots:-displayP,Q,R

Find the area of the shaded region.

intL,π8..3π8,numeric,ε=0.01

0.526726498845341

(6)

And find the maximum.

Optimization:-MaximizeL,mapunapply,x,xπ,x,optimalitytolerance=0.001

0.991236282390020151,1.50201622806699

(7)

Compatibility

• 

The Statistics[Lowess] command was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

See Also

Statistics[ScatterPlot]

Statistics[ScatterPlot3D]

CurveFitting[Lowess]

 

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam