NEWS
  • NLREG has been selected as the "Editor"s Pick" by SoftSeek.

    link to softseek.com

  • 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.

    Minimize Perpendicular Distance from Points to Plane


    This example shows a 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 distances of the points from the plane along lines perpendicular to the plane. For an NLREG example that minimizes the Z distances from the plane to the points, 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. (Note, this assumes c is not zero which would occur only if the plane is vertical.)

    ax + by + z + d = 0

    The distance of a point whose coordinates are (Xp,Yp,Zp) to the plane along a line perpendicular (normal) to the plane, is:

    Distance = |a*Xp + b*Yp + Zp + d| / sqrt(a^2 + b^2 + 1)

    The following NLREG program will minimize the sum of the squared distances.

    Title "Fit plane to data points along normal lines";
    Variables X, Y, Z;
    Parameters a, b, d;
    Double Distance;
    /*
     *  Compute distance from this point to the plane.
     */
    Distance = (a*X + b*Y + Z + d) / sqrt(a^2 + b^2 + 1);
    /*
     *  Minimize the squared distances.
     */
    Function Distance;
    Data;
    [data values go here]
    

    For an example NLREG program that performs orthogonal linear regression, please click here.



    Return to NLREG home page

    Download demonstration copy of NLREG.

    Download manuals for NLREG.

    Purchase NLREG.

    DTREG Decision Tree building software.