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.

    NLREG Special Applications

    Fitting The Integral Of A Function

    In some nonlinear regression applications, it may be necessary to fit data to the integral of a function rather than to the function itself. For example, the dependent variable might correspond to the area under a Gaussian distribution between lower and upper X values, so the function being fitted is the integral of the Gaussian distribution rather than the Gaussian distribution itself.

    To handle these situations, NLREG provides an "Integral" built-in, library function that computes the numerical integral of a function or expression using Romberg's method. Parameters whose values are being computed by NLREG may be used in expressions for the lower and upper limits of the integration interval, and they may be used in the expression that is being integrated.

    The form of the Integral function is: Integral(variable, LowLimit, HighLimit, expression[, tolerance])

    Variable is the name of a work variable that has been declared earlier in the program using a DOUBLE statement. The expression is integrated over this variable. Variable must consist only of a single variable name -- not an expression or constant -- and the variable must be a work variable, not a parameter or the dependent or independent variable.

    LowLimit is the lower limit of the integration range, and HighLimit is the upper limit of the integration range. Full expressions may be used to specify the low and high limits. These expressions may include operators, functions, parameters whose values are being calculated and dependent variables.

    Expression is the expression or function whose integral is to be computed. It may contain parameters and dependent variables. Usually it will contain the variable declared by the first argument (variable).

    Tolerance is an optional argument that may be omitted; it specifies the accuracy to which the integral will be computed. If you omit the tolerance parameter, a default value of 1E-8 is used. If you specify the tolerance parameter, its value must be in the range 1E-3 to 1E-14. As you decrease the tolerance value (i.e., approach 1E-14), the accuracy of the integral increases, and the computation time also increases -- sometimes dramatically.

    Here is an example NLREG program that fits the area under a Gaussian (normal distribution) curve to a set of data values. The independent variable, x, is the upper range of the region whose area corresponds to the value of the dependent variable, y. That is, the value of y corresponds to the area under the Gaussian from 0 up to x. Two parameters are calculated: mean -- the mean value of the Gaussian distribution, and StdDev -- the standard deviation of the distribution. The npd built-in, library function is used to compute the value of the Gaussian with a specified mean and standard deviation at a specified x value. The three parameters for npd are the x coordinate along the curve, the mean of the curve (i.e., center point of the distribution) and the standard deviation.

    Variables x, y;
    Parameters Mean, StdDev;
    Double t;
    Function y = Integral(t, 0, x, npd(t,Mean,StdDev));
    Data;
    
    In this example, the t work variable ranges from 0 to x as the integral is computed; so the value of npd(t,Mean,StdDev) is the height of the Gaussian for each value of t as t is swept across the interval (0,x); the Integral function computes the area under the curve across that interval.

    NLREG home page