NEWS NLREG has been selected as the "Editor"s Pick" by SoftSeek. NLREG is in use at hundreds of universities, laboratories, and government agencies around the world (over 20 countries). For a list of a few organizations using NLREG click here. If you have categorical variables, you may want to use a Decision Tree to model your data. Check out the DTREG Decision Tree Builder. You also should check out the News Rover program that automatically scans Usenet newsgroups, downloads messages of interest to you, decodes binary file attachments, reconstructs files split across multiple messages, and eliminates spam and duplicate files.

## Fit a plane to data points in 3D space

This example shows an NLREG program that fits a plane in 3-dimensional space to a set of data points whose X,Y,Z coordinates are specified.

In this example, the plane is fitted so as to minimize the sum of the squared Z (vertical) distances of the points from the plane. For an NLREG example that minimizes the distances of the points to the plane along lines perpendicular (normal) to the plane, click here

The implicit equation for a plane in 3D space is

ax + by + cz + d = 0

We can simplify this equation and eliminate the c parameter by dividing by c to get

ax + by + z + d = 0

Transposing to get z as the dependent variable produces

z = -ax - by - d

This equation is used in the following NLREG to fit the plane to a set of data points whose X, Y and Z coordinaes are specified.

```Title "Fit plane to data points in 3D space";
Variables X, Y, Z;
Parameters a, b, d;
Function z = -a*X - b*Y - d;
Plot;
Data;
[data values go here]
```

Here is a surface plot generated by NLREG showing the fitted plane: