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 Built-in Functions

    NLREG Built-in Functions

    The following functions are built into NLREG and may be used in expressions. Most of the trig functions have forms that take angles in units of radians and another form (same name ending with D) that take angles in units of degrees. The DEG() and RAD() functions can be used to convert between degrees and radians.

     

    ABS(x) -- Absolute value of x.

     

    ACOS(x) -- Arc cosine of x. The returned value is the angle in radians.

     

    ACOSD(x) -- Arc cosine of x. The returned value is the angle in degrees.

     

    ASIN(x) -- Arc sine of x. The angle must be specified in radians.

     

    ASIND(x) -- Arc sine of x. The angle must be specified in degrees.

     

    ATAN(x) -- Arc tangent of x. The returned angle is in units of radians.

     

    ATAND(x) -- Arc tangent of x. The returned angle is in units of degrees.

     

    BETAI(x,a,b) -- Incomplete beta function: Ix(a,b). The incomplete beta function can be used to compute a variety of statistical functions. For example, the probability of Student's t with df degrees of freedom can be computed with BETAI(df/(df+t2),.5*df,.5). The probability of the F statistic with df1 and df2 degrees of freedom can be computed with 2*BETAI(df2/(df2+df1*f),.5*df2,.5*df1).

     

    CEIL(x) -- Ceiling of x (an equivalent name for this function is INT). Returns the smallest integer that is at least as large as x. For example, CEIL(1.5)=2; CEIL(4)=4; CEIL(-2.6)=-2.

     

    COS(x) -- Cosine of x. The angle must be specified in radians.

     

    COSD(x) -- Cosine of x. The angle must be specified in degrees.

     

    COSH(x) -- Hyperbolic cosine of x.

     

    COT(x) -- Cotangent of x. (COT(x) = 1/TAN(x)). The angle must be specified in radians.

     

    COTD(x) -- Cotangent of x. (COTD(x) = 1/TAND(x)). The angle must be specified in degrees.

     

    CSC(x) -- Cosecant of x. (CSC(x) = 1/SIN(x)). The angle must be specified in radians.

     

    CSCD(x) -- Cosecant of x. (CSCD(x) = 1/SIND(x)). The angle must be specified in degrees.

     

    CTOP(angle) -- Convert an angle in the compass coordinate system to a polar coordinate angle. The polar coordinate system has the origin of an angle along the positive X axis and the angle increases in a counter-clockwise direction. The compass coordinate system has the positive Y axis as the origin (i.e., north) and the angle increases in a clockwise direction. The PTOC function performs the reverse transformation. The angle is in units of radians.

     

    CTOPD(angle) -- Same as ctop() except the angle is in units of degrees.

     

    DEG(x) -- Converts an angle, x, measured in radians to the equivalent number of degrees. Note, the built-in trig functions provided in NLREG have both radian and degree forms. The degree versions have the letter D appended to the end of their names such as sin(radians) and sind(degrees).

     

    EI1(alpha,phi) -- Elliptic integral of the first kind. Computes the integral from 0 to phi (degrees or radians) of the function d.phi/sqrt(1-k**2*sin(phi)**2), where k = sin(alpha). alpha and phi must be in the range 0 to 90 degrees or p/2 radians. The angle must be specified in radians.

     

    EI1D(alpha,phi) -- Same as ei1() except the angle is specified in degrees.

     

    EI2(alpha,phi) -- Elliptic integral of the second kind. Computes the integral from 0 to phi radians of the function sqrt(1-k**2*sin(phi)**2)*d.phi, where k = sin(alpha). alpha and phi must be in the range 0 to p/2 radians.

     

    EI2D(alpha,phi) -- Same as ei2() except the alpha and phi angles must be specified in degrees between 0 and 90.

     

    EIC1(alpha) -- Complete elliptic integral of the first kind. Computes the integral from 0 to p/2 radians of the function d.phi/sqrt(1-k**2*sin(phi)**2), where k = sin(alpha). alpha must be specified in radians and must be in the range 0 to p/2 radians.

     

    EIC1D(alpha) -- Same as eic1() except the angle must be specified in degrees and must be in the range 0 to 90.

     

    EIC2(alpha) -- Complete elliptic integral of the second kind. Computes the integral from 0 to or p/2 radians of the function sqrt(1-k**2*sin(phi)**2)*d.phi, where k = sin(alpha). alpha must be specified in radians and must be in the range 0 to p/2.

     

    EIC2D(alpha) -- Same as eic2() except alpha must be specified in degrees and must be in the range 0 to 90.

     

    ERF(x) -- Standard error function of x.

     

    EXP(x) -- e (base of natural logarithms) raised to the x power.

     

    FAC(x) -- x factorial (x!). Note, the FAC function is computed using the GAMMA function (FAC(x)=GAMMA(x+1)) so non-integer argument values may be computed.

     

    FLOOR(x) -- Floor of x. Returns the largest integer that is less than or equal to x. For example, FLOOR(2.5)=2; FLOOR(4)=4; FLOOR(-3.6)=-4.

     

    GAMMA(x) -- Gamma function. Note, GAMMA(x+1) = x! (i.e., x factorial).

     

    GAMMAI(x) -- Reciprocal of GAMMA function (GAMMAI(x) = 1/GAMMA(x)).

     

    GAMMALN(x) -- Log (base e) of the GAMMA function.

     

    GAMMP(a,x) -- Incomplete Gamma function.

     

    HAV(x) -- Haversine of x. (HAV(x) = (1-COS(x))/2). The angle must be specified in radians.

     

    HAVD(x) -- Haversine of x. (HAVD(x) = (1-COSD(x))/2). The angle must be specified in degrees.

     

    INT(x) -- Ceiling of x (an equivalent name for this function is CEIL). Returns the smallest integer that is at least as large as x. For example, INT(1.5)=2; INT(4)=4; INT(-2.6)=-2.

     

    J0(x) -- Bessel function of the first kind, order zero.

     

    J1(x) -- Bessel function of the first kind, order one.

     

    JN(n,x) -- Bessel function of the first kind, order n.

     

    LOG(x) -- Natural logarithm (base e) of x.

     

    LOG10(x) -- Base 10 logarithm of x.

     

    LOG2(x) -- Base 2 logarithm of x.

     

    MAX(x1,x2) -- Maximum value of x1 or x2.

     

    MIN(x1,x2) -- Minimum value of x1 or x2.

     

    NORMAL(x) -- Normal probability distribution of x. X is in units of standard deviations from the mean. See also the NPD function. NORMAL(x) = NPD(x,0,1);

     

    NPD(x,mean,std) -- Normal probability distribution of x with specified mean and standard deviation. X is in units of standard deviations from the mean.

     

    PAREA(x) -- Area under the normal probability distribution curve from -infinity to x.

     

    PRINTF("format'',value1,value2,...) -- Format and print a series of values. The NLREG printf function has the same syntax and function as the printf function in the C language. It causes a string to be written to your terminal and also the listing file for the analysis. Printf is primarily useful as a diagnostic tool to give you a way to observe what is happening during an analysis. Note: since your statements are executed for each data observation and each iteration, the printf may generate a great deal of output.

     

    The first argument to printf (format) is a quoted string that contains characters to be printed, control codes, and (if values are to be printed) formatting specifications. If you are familiar with the C programming language, the NLREG formatting string has the same form and control codes.

     

    Ordinary characters and numbers in the format string are printed just as they appear. Use the control code '\n' to cause a carriage-return, line-feed sequence to be printed to terminate a line. For example, the following statement prints a line of text:

     

    printf("Beginning of analysis\n");


    If you wish to insert formatted values in the string, specify one or more expressions after the format string. Place in the format string at the location where you want to insert the formatted value the sequence '%lf' (percent sign, lower case L, f) if you want the number formatted in the style nnnn.nnnnor; use '%lE' if you want exponential notation (nnn.nnnEnnn). Optionally, you may specify the width of the formatted value and the number of decimal places between '%' and 'l'. For example, the following sequence produces a formatted value with 8 total characters and 4 decimal places: %8.4lf. Here are several examples:

     

    printf("Processing observation %lf\n",obs);

    printf("X = %lf, Y = %lf\n",x,y);

    printf("Predicted = %14.6lE\n",predicted);

     

    PTOC(angle) -- Convert an angle in the polar coordinate system to a compass coordinate angle. The polar coordinate system has the origin of an angle along the positive X axis and the angle increases in a counter-clockwise direction. The compass coordinate system has the positive Y axis as the origin (i.e., north) and the angle increases in a clockwise direction. The CTOP function performs the reverse transformation. The angle is in units of radians.

     

    PTOCD(angle) -- Same as ptoc() except the angle is in units of degrees.

     

    PTORX(angle,distance) -- Convert a position in polar coordinates to the corresponding rectangular coordinate. This function returns the X coordinate of the position; use PTORY to obtain the Y coordinate. Note: polar coordinates are specified with the positive X axis being the origin for the angle and with the angle increasing in the counter-clockwise direction. The angle must be specified in units of radians.

     

    PTORXD(angle,distance) -- Same as ptorx() except the angle must be specified in units of degrees.

     

    PTORY(angle,distance) -- Convert a position in polar coordinates to the corresponding rectangular coordinate. This function returns the Y coordinate of the position; use PTORX to obtain the X coordinate. Note: polar coordinates are specified with the positive X axis being the origin for the angle and with the angle increasing in the counter-clockwise direction. The angle must be specified in units of radians.

     

    PTORYD(angle,distance) -- Same as ptory() except the angle must be specified in units of degrees.

     

    PULSE(a,x,b) -- Pulse function. If the value of x is less than a or greater than b, the value of the function is 0. If x is greater than or equal to a and less than or equal to b, the value of the function is 1. In other words, it is 1 for the domain (a,b) and zero elsewhere. If you need a function that is zero in the domain (a,b) and 1 elsewhere, use the expression (1-PULSE(a,x,b)).

     

    RAD(x) -- Converts an angle measured in degrees to the equivalent number of radians. Note, the built-in trig functions provided in NLREG have both radian and degree forms. The degree versions have the letter D appended to the end of their names such as sin(radians) and sind(degrees).

     

    RANDOM() -- Returns a random value uniformly distributed in the range 0 to 1.

     

    ROUND(x) -- Rounds x to the nearest integer. For example, ROUND(1.1)=1; ROUND(1.8)=2; ROUND(-2.8)=-3;

     

    RTOPA(x,y) -- Convert a rectangular coordinate (x,y) to the corresponding polar coordinate (angle,distance). This function returns the angle (in radians), use RTOPD to get the distance coordinate. Note: polar coordinates are specified with the positive X axis being the origin for the angle and with the angle increasing in the counter-clockwise direction.

     

    RTPOPAD(x,y) Same as RTOPA() except the angle is in degrees.

     

    RTOPD(x,y) -- Convert a rectangular coordinate to the corresponding polar coordinate. This function returns the distance from the origin, use RTOPA to get the angle. Note: polar coordinates are specified with the positive X axis being the origin for the angle and with the angle increasing in the counter-clockwise direction.

     

    SEC(x) -- Secant of x. (SEC(x) = 1/COS(x)). The angle must be specified in radians.

     

    SECD(x) -- Secant of x. (SECD(x) = 1/COSD(x)). The angle must be specified in degrees.

     

    SEL(a1,a2,v1,v2) -- If a1 is less than a2 then the value of the function is v1. If a1 is greater than or equal to a2, then the value of the function is v2.

     

    SIN(x) -- Sine of x. The angle must be specified in radians. See TREND.NLR for an example of a function with a sin term.

     

    SIND(x) -- Sine of x. The angle must be specified in degrees.

     

    SINH(x) -- Hyperbolic sine of x.

     

    SQRT(x) -- Square root of x.

     

    STEP(a,x) -- Step function. If x is less than a, the value of the function is 0. If x is greater than or equal to a, the value of the function is 1. If you need a function which is 1 up to a certain value and then 0 beyond that value, use the expression STEP(x,a).

     

    T(n,x) -- Chebyshev polynomial of order n.

     

    TAN(x) -- Tangent of x. The angle must be in units of radians.

     

    TAND(x) -- Tangent of x. The angle must be in units of degrees.

     

    TANH(x) -- Hyperbolic tangent of x.

     

    Y0(x) -- Bessel function of the second kind, order zero.

     

    Y1(x) -- Bessel function of the second kind, order one.

     

    YN(n,x) -- Bessel function of the second kind, order n.

     

     



    Return to NLREG home page

    Download demonstration copy of NLREG.

    Download manuals for NLREG.

    Purchase NLREG.

    DTREG Decision Tree building software.