Local (Loess) Regression

Local regression fits a nonparametric smooth response surface modeling how some response is affected by one or more predictors. It may be used to obtain a smooth fit for 2D or 3D data. Detailed fitting options and diagnostics are available.

To perform local regression

Choose Statistics __image\arrow5.gif Regression __image\arrow5.gif Local (Loess). The dialog shown below appears.

Model Page

__image\local1.gif

In the Local Regression dialog, the Model page has the following options:

Data

Data Set

Select a data set from the dropdown list or type the name of a data set. You can also type into the Data Set edit field any expression that evaluates to a data set.

Weights

Enter the column that specifies weights to be applied to all observations used in the analysis. To weight all rows equally, leave this blank.

Subset Rows

Enter an S-PLUS expression that identifies the rows to use in the analysis. To use all the rows in the data set, leave this field blank.

Omit Rows with Missing Values

Select this box to omit from the analysis any rows in the data set that contain missing values for any of the variables in the model.

Variables

Dependent Variables

Select a variable as the dependent variable in the formula. The variable name will appear in the formula field below, followed by a '~'.

Independent Variables

Select one or more variables as the independent variables, or predictor, in the formula. To select more than one variable, Ctrl-click the variables.

Formula

In the Formula field, enter a formula specifying the desired model. In its simplest form a formula consists of the response variable, a tilde (~), and a list of predictor variables separated by "+"s. An intercept is automatically included by default.

Save Model Object

In the Save As field, enter the name for the object in which to save the results of the analysis. If an object with this name already exists, its contents are overwritten. The model object can be used in later functions such as plotting.

Options Page

__image\local2.gif

In the Local Regression dialog, the Options page has the following options:

Model

Family

Choose either gaussian or symmetric as the distribution for the error term.

Normalize Numeric Predictors

Click to use the standard normalized values of numeric predictors as predictors in the model.

Add Quadratic Term in Local Fitting

Select this to use locally-quadratic fitting. Clear the check box to use locally-linear fitting.

Drop Quadratic Terms in

Select the variables for which locally-linear fitting will be used. This field is only active when Add Quadratic Term in Local Fitting is selected.

Conditionally Parametric in

Select the associated predictors in the case that a portion of the model is of parametric approach.

Local Smoothness

Span

Select or enter a number between 0 and 1 to set the smoothness parameter. A larger fraction generates a smoother curve. The default value is 0.75.

Equivalent Number of Parameters

Enter a number, analogous to the number of parameters in the model, to specify smoothness.

Control Parameters

Most users don't need to set the control parameters, since the default provides very satisfactory performance in most of the cases. Changing these parameters can substantially burden the computation for large data sets.

Surface Fitting Choose direct to use observed responses directly in the surface fitting. By default, interpolated points are used in the fitting.

Cell Size Enter the number of cells used in locally fitting. This field is enabled only when interpolate is chosen above.

Number of Iterations Enter the number of iterations. This field is enabled only when Family is specified as symmetric on the Model page.

Results Page

On the Results page, choose the type of printed results and how you would like the results of the analysis saved. To select or clear an option, click the check box.

__image\local3.gif

In the Local Regression dialog, the Results page has the following options:

Printed Results

Short Output for Local Regression

Display a short summary of the model fit. This includes the model formula, the number of observations, equivalent number of parameters, the residual standard error, the multiple R-Squared value, and the residuals. If you do not want printed results, clear this check box.

Saved Results

Save In

Enter the name of a data set in which a part of the analysis, such as fitted values and residuals, predictions, confidence intervals, or standard errors, is saved.

Fitted Values

Save the fitted values from the model in the object specified in Save In.

Residuals

Save the residuals from the model in the object specified in Save In. These are the ordinary residuals (the response minus the fitted value).

Plot Page

On the Plot page, choose the type of plots, smoothing and rugplot options, and partial residual plot options. To select or clear an option, click the check box.

__image\local4.gif

In the Local Regression dialog, the Plot page has the following options:

Plots

Residuals vs Fit

Select this to display a plot of the residuals versus the fitted values.

Sqrt Abs Residuals vs Fit

Display a plot of the square root of the absolute values of the residuals versus the fitted values. This plot is useful for checking for the constant variance assumption of the model.

Response vs Fit

Display a plot of the response variable versus the fitted values. The line y = x is also drawn on the graph.

Residuals Normal QQ

Display a normal quantile-quantile plot of the residuals.

Residual-Fit Spread

Display a residual-fit spread plot. This is a visual analog of the multiple R-squared statistic. It compares the spread of the fitted values to the spread of the residuals.

Cond. Plots of Fitted vs Predictors

Display the conditional plots of fitted values versus predictors.

Options

Include Smooth

Display a smooth curve, computed with loess.smooth, on the Residuals vs Fit, Sqrt Abs Residuals vs Fit, and Response vs Fit plots. See the online Help for loess.smooth for details.

Include Rugplot

Display a rugplot on the Residuals vs Fit, Sqrt Abs Residuals vs Fit, and Response vs Fit plots. A rugplot is a sequence of vertical bars along the x-axis that mark the "observed" x values.

Number of Extreme Points to Identify

Enter the number of extreme points that are identified on the Residuals vs Fit, Sqrt Abs Residuals vs Fit, Residuals Normal QQ, and Cook's Distance plots. The row names from the data set specified on the model page are used to identify the points.

Predict page

__image\local5.gif

In the Local Regression dialog, the Predict page has the following options:

New Data

Enter the name of a matrix or data set to use for computing predictions. It must contain the same names as the terms in the right side of the formula for the model. If omitted, the original data are used for computing predictions.

Save

Save In

Enter the name of a data set in which a part of the analysis, such as fitted values and residuals, predictions, confidence intervals, or standard errors, is saved.

Predictions

Select this to save predictions to the data set specified in Save In.

Standard Errors

Store the pointwise standard errors for the predictions in the object specified in Save In.

Related S-Plus language functions

loess, loess.control, anova.loess, predict.loess, plot.loess