home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / business / nonlin22.zip / NONLIN.DOC < prev    next >
Text File  |  1993-04-17  |  114KB  |  2,325 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                                     N O N L I N
  7.  
  8.  
  9.  
  10.                        Nonlinear Regression Analysis Program
  11.  
  12.  
  13.  
  14.  
  15.                                  Phillip H. Sherrod
  16.  
  17.                 Member, Association of Shareware Professionals (ASP)
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.              Nonlin  allows  you  to  perform  statistical   regression
  25.              analyses  to estimate the values of parameters for linear,
  26.              multivariate,   polynomial,    and    general    nonlinear
  27.              functions.   The regression analysis determines the values
  28.              of the parameters which cause the  function  to  best  fit
  29.              the  observed data that you provide.  Nonlin allows you to
  30.              specify the function whose parameters are being  estimated
  31.              using   ordinary   algebraic  notation.   In  addition  to
  32.              determining  the  parameter  estimates,  Nonlin   can   be
  33.              directed  to generate an output file with predicted values
  34.              and residuals.  It can also  plot  the  data  observations
  35.              and   the   computed   function.   Although  designed  for
  36.              regression analysis, Nonlin can also be used to  find  the
  37.              root   (zero   point)  or  minimum  absolute  value  of  a
  38.              nonlinear  expression.   Nonlin  is   in   use   at   many
  39.              engineering and research centers around the world.
  40.  
  41.  
  42.  
  43.  
  44.  
  45.                                  Table of Contents
  46.  
  47.  
  48.  
  49.          1. Introduction . . . . . . . . . . . . . . . . . . . . . . . .  1
  50.            1.1 Introduction to Regression Analysis . . . . . . . . . . .  1
  51.            1.2 Introduction to Nonlin  . . . . . . . . . . . . . . . . .  2
  52.            1.3 Installing Nonlin . . . . . . . . . . . . . . . . . . . .  3
  53.  
  54.          2. Using Nonlin . . . . . . . . . . . . . . . . . . . . . . . .  5
  55.            2.1 Function Specification  . . . . . . . . . . . . . . . . .  6
  56.              2.1.1 Arithmetic Operators  . . . . . . . . . . . . . . . .  6
  57.              2.1.2 Numeric Constants . . . . . . . . . . . . . . . . . .  6
  58.              2.1.3 Symbolic Constants  . . . . . . . . . . . . . . . . .  6
  59.              2.1.4 Built-in Constants  . . . . . . . . . . . . . . . . .  6
  60.              2.1.5 Built-in Functions  . . . . . . . . . . . . . . . . .  7
  61.            2.2 Nonlin Command Files  . . . . . . . . . . . . . . . . . .  9
  62.  
  63.          3. Nonlin Commands  . . . . . . . . . . . . . . . . . . . . . . 11
  64.            3.1 TITLE . . . . . . . . . . . . . . . . . . . . . . . . . . 11
  65.            3.2 VARIABLES . . . . . . . . . . . . . . . . . . . . . . . . 11
  66.            3.3 PARAMETERS  . . . . . . . . . . . . . . . . . . . . . . . 11
  67.            3.4 CONFIDENCE  . . . . . . . . . . . . . . . . . . . . . . . 12
  68.            3.5 CONSTANT  . . . . . . . . . . . . . . . . . . . . . . . . 12
  69.            3.6 CONSTRAIN . . . . . . . . . . . . . . . . . . . . . . . . 13
  70.            3.7 COVARIANCE  . . . . . . . . . . . . . . . . . . . . . . . 13
  71.            3.8 SWEEP . . . . . . . . . . . . . . . . . . . . . . . . . . 13
  72.            3.9 FUNCTION  . . . . . . . . . . . . . . . . . . . . . . . . 14
  73.            3.10 TOLERANCE  . . . . . . . . . . . . . . . . . . . . . . . 14
  74.            3.11 ITERATIONS . . . . . . . . . . . . . . . . . . . . . . . 14
  75.            3.12 REGISTER . . . . . . . . . . . . . . . . . . . . . . . . 15
  76.            3.13 OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . 15
  77.            3.14 POUTPUT  . . . . . . . . . . . . . . . . . . . . . . . . 16
  78.            3.15 PLOT . . . . . . . . . . . . . . . . . . . . . . . . . . 16
  79.            3.16 RPLOT  . . . . . . . . . . . . . . . . . . . . . . . . . 17
  80.            3.17 NPLOT  . . . . . . . . . . . . . . . . . . . . . . . . . 18
  81.            3.18 PRESOLUTION  . . . . . . . . . . . . . . . . . . . . . . 19
  82.            3.19 WIDTH  . . . . . . . . . . . . . . . . . . . . . . . . . 19
  83.            3.20 DATA . . . . . . . . . . . . . . . . . . . . . . . . . . 19
  84.  
  85.          4. Understanding The Results  . . . . . . . . . . . . . . . . . 21
  86.            4.1 Descriptive Statistics for Variables  . . . . . . . . . . 21
  87.            4.2 Parameter Estimates . . . . . . . . . . . . . . . . . . . 21
  88.            4.3 t Statistic . . . . . . . . . . . . . . . . . . . . . . . 21
  89.            4.4 Prob(t) . . . . . . . . . . . . . . . . . . . . . . . . . 22
  90.            4.5 Final Sum of Squared Deviations . . . . . . . . . . . . . 22
  91.            4.6 Average and Maximum Deviation . . . . . . . . . . . . . . 22
  92.            4.7 Proportion of Variance Explained  . . . . . . . . . . . . 22
  93.            4.8 Adjusted Coefficient of Multiple Determination  . . . . . 23
  94.            4.9 Durbin-Watson Statistic . . . . . . . . . . . . . . . . . 23
  95.            4.10 Analysis of Variance Table . . . . . . . . . . . . . . . 24
  96.  
  97.  
  98.                                          i
  99.  
  100.          Contents                                                        ii
  101.  
  102.  
  103.  
  104.          5. Theory of Operation  . . . . . . . . . . . . . . . . . . . . 25
  105.            5.1 Minimization Algorithm  . . . . . . . . . . . . . . . . . 25
  106.            5.2 Convergence Criterion . . . . . . . . . . . . . . . . . . 25
  107.  
  108.          6. Hints for Nonlin Use . . . . . . . . . . . . . . . . . . . . 27
  109.            6.1 Convergence Failures  . . . . . . . . . . . . . . . . . . 27
  110.            6.2 Singular Matrix Problems  . . . . . . . . . . . . . . . . 28
  111.            6.3 Performance Issues  . . . . . . . . . . . . . . . . . . . 28
  112.            6.4 Program Limits  . . . . . . . . . . . . . . . . . . . . . 29
  113.  
  114.          7. Example Analyses . . . . . . . . . . . . . . . . . . . . . . 30
  115.  
  116.          8. Root Finding and Function Minimization . . . . . . . . . . . 33
  117.            8.1 Specifying a Minimization Problem . . . . . . . . . . . . 33
  118.            8.2 Function Minimization Examples  . . . . . . . . . . . . . 34
  119.  
  120.          9. Acknowledgement and Use of Nonlin  . . . . . . . . . . . . . 36
  121.            9.1 Acknowledgement . . . . . . . . . . . . . . . . . . . . . 36
  122.            9.2 Use and Distribution of Nonlin  . . . . . . . . . . . . . 36
  123.            9.3 Association of Shareware Professionals  . . . . . . . . . 37
  124.            9.4 Copyright Notice  . . . . . . . . . . . . . . . . . . . . 37
  125.            9.5 Disclaimer  . . . . . . . . . . . . . . . . . . . . . . . 37
  126.  
  127.          10. Other Software  . . . . . . . . . . . . . . . . . . . . . . 38
  128.            10.1 Mathplot -- Mathematical Function Plotting Program . . . 38
  129.            10.2 TSX-32 -- Multi-User Operating System  . . . . . . . . . 38
  130.  
  131.          11. Software Order Form . . . . . . . . . . . . . . . . . . . . 40
  132.  
  133.          Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.                                      Chapter 1
  141.  
  142.                                     Introduction
  143.  
  144.  
  145.  
  146.  
  147.          1.1 Introduction to Regression Analysis
  148.  
  149.          The  goal  of  regression  analysis  is to determine the values of
  150.          parameters for a function that cause the function to  best  fit  a
  151.          set  of data observations that you provide.  In linear regression,
  152.          the function is a linear (straight line) equation.   For  example,
  153.          if  we  assume  the value of an automobile decreases by a constant
  154.          amount each year after its purchase, and  for  each  mile  driven,
  155.          the  following  linear  function  would  predict  its  value  (the
  156.          dependent  variable)  as  a  function  of  the   two   independent
  157.          variables which are age and miles:
  158.  
  159.               value = price + depage*age + depmiles*miles
  160.  
  161.          where  `value',  the  dependent variable, is the value of the car,
  162.          `age' is the age of the car, and `miles' is the  number  of  miles
  163.          that the car has been driven.
  164.  
  165.          The  regression  analysis  performed  by Nonlin will determine the
  166.          best values of the three parameters, `price', the estimated  value
  167.          when  age  is  0  (i.e.,  when  the  car  was  new), `depage', the
  168.          depreciation that takes  place  each  year,  and  `depmiles',  the
  169.          depreciation  for  each  mile  driven.  The values of `depage' and
  170.          `depmiles' will be negative because the car  loses  value  as  age
  171.          and miles increase.
  172.  
  173.          In  a  problem  such  as  this  car depreciation example, you must
  174.          provide a data file containing the values  of  the  dependent  and
  175.          independent  variables for a set of observations.  In this example
  176.          each observation record would contain three numbers:  value,  age,
  177.          and  miles,  collected  from  used car ads for the same model car.
  178.          The more observations you provide, the more accurate will  be  the
  179.          estimate  of  the parameters.  The Nonlin commands to perform this
  180.          regression are shown below:
  181.  
  182.               VARIABLES VALUE,AGE,MILES
  183.               PARAMETERS PRICE,DEPAGE,DEPMILES
  184.               FUNCTION VALUE = PRICE + DEPAGE*AGE + DEPMILES*MILES
  185.               DATA
  186.               (data values go here)
  187.  
  188.          Once the values of the parameters are determined  by  Nonlin,  you
  189.          can  use  the  formula  to predict the value of a car based on its
  190.  
  191.  
  192.                                          1
  193.  
  194.          Chapter 1. Introduction                                          2
  195.  
  196.  
  197.          age and miles driven.  For example, if Nonlin computed a value  of
  198.          16000  for  price,  -1000 for depage, and -0.15 for depmiles, then
  199.          the function
  200.  
  201.               value = 16000 - 1000*age - 0.15*miles
  202.  
  203.          could be used to estimate the value of a car with a known age  and
  204.          number of miles.
  205.  
  206.          If  a  perfect  fit  existed  between  the function and the actual
  207.          data, the actual value  of  each  car  in  your  data  file  would
  208.          exactly  equal  the  predicted value.  Typically, however, this is
  209.          not the case, and the difference between the actual value  of  the
  210.          dependent  variable  and  its  predicted  value  for  a particular
  211.          observation is the error of the estimate which  is  known  as  the
  212.          "deviation"  or "residual".  The goal of regression analysis is to
  213.          determine the values of the parameters which minimize the  sum  of
  214.          the  squared residual values for the set of observations.  This is
  215.          known as a "least squares" regression fit.
  216.  
  217.          1.2 Introduction to Nonlin
  218.  
  219.          Nonlin is a very powerful regression analysis program.   Using  it
  220.          you  can  perform  multivariate,  linear,  polynomial, and general
  221.          nonlinear regression.  What this means is  that  you  specify  the
  222.          form  of  the  function to be fitted to the data, and the function
  223.          can include nonlinear terms such as  variables  raised  to  powers
  224.          and  library  functions  such  as  log,  exponential,  sine,  etc.
  225.          Nonlin uses a state-of-the-art regression algorithm that works  as
  226.          well,  or  better,  than  any you are likely to find in commercial
  227.          statistical packages.
  228.  
  229.          As  an  example  of   nonlinear   regression,   consider   another
  230.          depreciation  problem.  The value of a used airplane decreases for
  231.          each year of its age.  Assuming the value of a plane falls by  the
  232.          same  amount  each  year,  a linear function relating value to age
  233.          is:
  234.  
  235.               Value = p0 + p1*Age
  236.  
  237.          Where `p0' and `p1' are the parameters  whose  values  are  to  be
  238.          determined.   However,  it  is  a well known fact that planes (and
  239.          automobiles) lose more value the first year than the  second,  and
  240.          more  the  second  than  the third, etc.  This means that a linear
  241.          (straight line) function cannot accurately model  this  situation.
  242.          A better, nonlinear, function is:
  243.  
  244.               Value = p0 + p1*exp(-p2*Age)
  245.  
  246.          Where  the  `exp' function is the value of e (2.7182818...) raised
  247.          to  a  power.   This  type  of  function  is  known  as  "negative
  248.          exponential"  and  is  appropriate for modeling a value whose rate
  249.          of decrease is proportional to the difference  between  the  value
  250.          and  some base value.  The F33YEAR.NLR example command file fits a
  251.          linear function to the value of used  airplanes.   The  F33EXP.NLR
  252.  
  253.          Chapter 1. Introduction                                          3
  254.  
  255.  
  256.          example  fits  a  negative  exponential function to the same data.
  257.          Run both examples and compare the fitted functions.   See  F33.NLR
  258.          for  an  example  of a multiple regression using three independent
  259.          variables.
  260.  
  261.          Much of the convenience of Nonlin comes from  the  fact  that  you
  262.          can   enter   complicated   functions   using  ordinary  algebraic
  263.          notation.  Examples of functions that can be handled  with  Nonlin
  264.          include:
  265.  
  266.               Linear:        Y = p0 + p1*X
  267.  
  268.               Quadratic:     Y = p0 + p1*X + p2*X^2
  269.  
  270.               Multivariate:  Y = p0 + p1*X + p2*Z + p3*X*Z
  271.  
  272.               Exponential:   Y = p0 + p1*exp(X)
  273.  
  274.               Periodic:      Y = p0 + p1*sin(p2*X)
  275.  
  276.               Misc:          Y = p0 + p1*Y + p2*exp(Y) + p3*sin(Z)
  277.  
  278.          In  other  words,  the  function is a general expression involving
  279.          one dependent variable (on the left of the  equal  sign),  one  or
  280.          more  independent  variables,  and  one  or  more parameters whose
  281.          values are to be estimated.
  282.  
  283.          Because  of  its  generality,  Nonlin  can  perform  all  of   the
  284.          regressions  handled by ordinary linear or multivariate regression
  285.          programs as well as nonlinear regression.  However,  in  order  to
  286.          handle  nonlinear  functions,  Nonlin  uses  an iterative function
  287.          optimization algorithm which is  slower  than  the  simple  linear
  288.          regression  algorithm  and has the potential for not converging to
  289.          a solution.
  290.  
  291.          1.3 Installing Nonlin
  292.  
  293.          The Nonlin system consists of the following files:
  294.  
  295.                 NONLIN.EXE -- The executable program.
  296.                 NONLIN.DOC -- Documentation file.
  297.                 NONLIN.FON -- Font file used if you request a plot.
  298.                 NONLIN.LJF -- LaserJet font file (registered version only).
  299.                      *.NLR -- Example command files.
  300.               REGISTER.DOC -- Form used to register your use of Nonlin.
  301.  
  302.          To install Nonlin, copy the  files  into  the  directory  of  your
  303.          choice.   The  registered  version of Nonlin includes a file named
  304.          NONLIN.LJF  with  the  fonts  needed  for  printing  plots  on  HP
  305.          LaserJet  printers.   If  you  do  not plan to generated hard copy
  306.          output for a LaserJet  printer,  you  may  delete  the  NONLIN.LJF
  307.          file.   If  the  NONLIN.FON  and  NONLIN.LJF files are not in your
  308.          current directory, you must place a command of the following  form
  309.          in  your  AUTOEXEC.BAT  file  to tell Nonlin where to look for its
  310.          font files:
  311.  
  312.          Chapter 1. Introduction                                          4
  313.  
  314.  
  315.               SET NONLIN=directory
  316.  
  317.          Where "directory" is the name of the device  and  directory  where
  318.          the  files  are located.  For example, if the files are located in
  319.          a directory named NONLIN on the  C  disk,  the  following  command
  320.          could be used:
  321.  
  322.               SET NONLIN=C:\NONLIN
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.                                      Chapter 2
  330.  
  331.                                     Using Nonlin
  332.  
  333.  
  334.  
  335.  
  336.          Once  Nonlin  has  been  installed,  it can be started using a DOS
  337.          command of the form:
  338.  
  339.               NONLIN command_file [listing_file]
  340.  
  341.          where "command_file" is the  name  of  a  file  containing  Nonlin
  342.          commands  that  control  the  analysis.   The sections that follow
  343.          describe these commands.  If  you  specify  a  command  file  name
  344.          without  an  extension,  ".NLR"  is used as the default extension.
  345.          If you omit the command file name, Nonlin prints  a  list  of  its
  346.          commands.
  347.  
  348.          A  "listing_file"  parameter may be specified on the command line.
  349.          If  you  specify  a  file  name,  the  output  (results)  of   the
  350.          regression  analysis are written to this file.  If no file name is
  351.          specified, the output is written to a file with the same  name  as
  352.          the  command_file but with the extension ".LST".  If you specify a
  353.          listing file name without an extension, ".LST" is provided as  the
  354.          default  extension.   Specify  NUL  for the listing_file if you do
  355.          not want to generate an output file.
  356.  
  357.          For  example,  to  process  a  command  file   named   LINEAR.NLR,
  358.          directing  output  to  a  file named LINEAR.LST, use the following
  359.          command:
  360.  
  361.               NONLIN LINEAR
  362.  
  363.          To do the same analysis, directing the  output  to  a  file  named
  364.          MODEL1.LST, use the following command:
  365.  
  366.               NONLIN LINEAR MODEL1
  367.  
  368.          At  this  point,  I  suggest  you  pause  in  your reading and try
  369.          running a Nonlin example to get a feel for how it works.   Several
  370.          example  files  with  the  extension  ".NLR" are provided with the
  371.          distribution.  LINEAR.NLR is a good one to start with.  If you  do
  372.          not  have  a  graphics  monitor,  edit the LINEAR.NLR command file
  373.          (and other example files) and remove the PLOT command.
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.                                          5
  382.  
  383.          Chapter 2. Using Nonlin                                          6
  384.  
  385.  
  386.          2.1 Function Specification
  387.  
  388.          Much of the power of Nonlin comes from  its  ability  to  estimate
  389.          the  value  of  parameters  that are part of complicated functions
  390.          that you enter in ordinary algebraic form.  This section  explains
  391.          the  arithmetic  operators and built-in functions that are used to
  392.          specify a function.
  393.  
  394.          2.1.1 Arithmetic Operators
  395.  
  396.          The following arithmetic operators may be used in expressions:
  397.  
  398.               +        addition
  399.               -        subtraction or unary minus
  400.               *        multiplication
  401.               /        division
  402.               ** or ^  exponentiation
  403.  
  404.          Exponentiation   has   the   highest   precedence,   followed   by
  405.          multiplication  and  division,  and then addition and subtraction.
  406.          Parentheses may be used to group terms.
  407.  
  408.          2.1.2 Numeric Constants
  409.  
  410.          Numeric constants may be written in  their  natural  form  (1,  0,
  411.          1.5,  .0003,  etc.) or in exponential form, n.nnnEppp, where n.nnn
  412.          is the base value and ppp is the power of ten by  which  the  base
  413.          is  multiplied.   For  example,  the number 1.5E4 is equivalent to
  414.          15000.  All  numbers  are  treated  as  "floating  point"  values,
  415.          regardless  of  whether a decimal point is specified or not.  As a
  416.          convenience for entering time values, if a value contains  one  or
  417.          more  colons,  the  portion to the left of the colon is multiplied
  418.          by 60.   For  example,  1:00  is  equivalent  to  60;  1:00:00  is
  419.          equivalent to 3600.
  420.  
  421.          2.1.3 Symbolic Constants
  422.  
  423.          You  can use the CONSTANT command to associate symbolic names with
  424.          constant numeric values.  When you use the symbolic  name  in  the
  425.          function the numeric value is substituted for the symbolic name.
  426.  
  427.          2.1.4 Built-in Constants
  428.  
  429.          There  are  two  built-in  numeric constants that may be specified
  430.          using symbolic names.  The symbolic name  "PI"  is  equivalent  to
  431.          the  value of pi, 3.14159...  Similarly, the symbolic constant "E"
  432.          is equivalent to the base of natural logarithms,  e,  2.7182818...
  433.          You may write PI and E using either upper or lower case.
  434.  
  435.          Chapter 2. Using Nonlin                                          7
  436.  
  437.  
  438.          2.1.5 Built-in Functions
  439.  
  440.          The  following  functions are built into Nonlin and may be used in
  441.          expressions:
  442.  
  443.          ABS(x) -- Absolute value of x.
  444.  
  445.          ACOS(x) -- Arc cosine of x.  Angles are measured in radians.
  446.  
  447.          ASIN(x) -- Arc sine of x.  Angles are measured in radians.
  448.  
  449.          ATAN(x) -- Arc tangent of x.  Angles are measured in radians.
  450.  
  451.          BETAI(x,a,b)  --   Incomplete   beta   function:   Ix(a,b).    The
  452.          incomplete  beta  function  can  be  used  to compute a variety of
  453.          statistical functions.  For example, the probability of  Student's
  454.          t   with   `df'   degrees   of   freedom   can  be  computed  with
  455.          BETAI(df/(df+t^2),.5*df,.5).  The probability of the  F  statistic
  456.          with  df1  and  df2  degrees  of  freedom  can  be  computed  with
  457.          2*BETAI(df2/(df2+df1*f),.5*df2,.5*df1).
  458.  
  459.          COS(x) -- Cosine of x.  Angles are measured in radians.
  460.  
  461.          COSH(x) -- Hyperbolic cosine of x.
  462.  
  463.          COT(x)  --  Cotangent  of  x.   (COT(x)  =  1/TAN(x)).   Angle  in
  464.          radians.
  465.  
  466.          CSC(X) -- Cosecant of x.  (CSC(x) = 1/SIN(x)).  Angle in radians.
  467.  
  468.          DEG(x)  --  Converts  an  angle,  x,  measured  in  radians to the
  469.          equivalent number of degrees.
  470.  
  471.          EI1(alpha,phi) -- Elliptic integral of the first  kind.   Computes
  472.          the   integral   from   0   to   phi   radians   of  the  function
  473.          d.phi/sqrt(1-k**2*sin(phi)**2), where k = sin(alpha).   alpha  and
  474.          phi must be in the range 0 to pi/2.
  475.  
  476.          EI2(alpha,phi)  -- Elliptic integral of the second kind.  Computes
  477.          the  integral  from   0   to   phi   radians   of   the   function
  478.          sqrt(1-k**2*sin(phi)**2)*d.phi,  where  k = sin(alpha).  alpha and
  479.          phi must be in the range 0 to pi/2.
  480.  
  481.          EIC1(alpha) -- Complete  elliptic  integral  of  the  first  kind.
  482.          Computes  the  integral  from  0  to  pi/2 radians of the function
  483.          d.phi/sqrt(1-k**2*sin(phi)**2), where k = sin(alpha).  alpha  must
  484.          be in the range 0 to (less than) pi/2.
  485.  
  486.          EIC2(alpha)  --  Complete  elliptic  integral  of the second kind.
  487.          Computes the integral from 0  to  pi/2  radians  of  the  function
  488.          sqrt(1-k**2*sin(phi)**2)*d.phi,  where k = sin(alpha).  alpha must
  489.          be in the range 0 to pi/2.
  490.  
  491.          ERF(x) -- Standard error function of x.
  492.  
  493.          Chapter 2. Using Nonlin                                          8
  494.  
  495.  
  496.          EXP(x) -- e (base of natural logarithms) raised to the x power.
  497.  
  498.          FAC(x) -- x factorial (x!).  Note, the FAC  function  is  computed
  499.          using   the  GAMMA  function  (FAC(x)=GAMMA(x+1))  so  non-integer
  500.          argument values may be computed.
  501.  
  502.          GAMMA(x)  --  Gamma  function.   Note,   GAMMA(x+1)   =   x!    (x
  503.          factorial).
  504.  
  505.          GAMMAI(x)   --   Reciprocal   of   GAMMA   function  (GAMMAI(x)  =
  506.          1/GAMMA(x)).
  507.  
  508.          GAMMALN(x) -- Log (base e) of the GAMMA function.
  509.  
  510.          HAV(x) -- Haversine of x.   (HAV(x)  =  (1-COS(x))/2).   Angle  in
  511.          radians.
  512.  
  513.          J0(x) -- Bessel function of the first kind, order zero.
  514.  
  515.          J1(x) -- Bessel function of the first kind, order one.
  516.  
  517.          JN(n,x) -- Bessel function of the first kind, order n.
  518.  
  519.          LOG(x) -- Natural logarithm of x.
  520.  
  521.          LOG10(x) -- Base 10 logarithm of x.
  522.  
  523.          LOG2(x) -- Base 2 logarithm of x.
  524.  
  525.          MAX(x1,x2) -- Maximum value of x1 or x2.
  526.  
  527.          MIN(x1,x2) -- Minimum value of x1 or x2.
  528.  
  529.          NORMAL(x)  -- Normal probability distribution of x.  X is in units
  530.          of standard deviations from the mean.  See also the NPD  function.
  531.          NORMAL(x) = NPD(x,0,1);
  532.  
  533.          NPD(x,mean,std)  --  Normal  probability  distribution  of  x with
  534.          specified mean and standard deviation.  X is in units of  standard
  535.          deviations from the mean.
  536.  
  537.          PAREA(x)  --  Area under the normal probability distribution curve
  538.          from -infinity to x.  (i.e.,  integral  from  -infinity  to  x  of
  539.          NORMAL(x)).
  540.  
  541.          PULSE(a,x,b)  -- Pulse function.  If the value of x is less than a
  542.          or greater than b, the value of  the  function  is  0.   If  x  is
  543.          greater  than or equal to a and less than or equal to b, the value
  544.          of the function is 1.  In other words, it  is  1  for  the  domain
  545.          (a,b)  and zero elsewhere.  If you need a function that is zero in
  546.          the  domain  (a,b)   and   1   elsewhere,   use   the   expression
  547.          (1-PULSE(a,x,b)).
  548.  
  549.          RAD(x)  -- Converts an angle measured in degrees to the equivalent
  550.          number of radians.
  551.  
  552.          Chapter 2. Using Nonlin                                          9
  553.  
  554.  
  555.          SEC(x) -- Secant of x.  (SEC(x) = 1/COS(x)).  Angle in radians.
  556.  
  557.          SEL(a1,a2,v1,v2) -- If a1 is less than a2 then the  value  of  the
  558.          function  is  v1.   If a1 is greater than or equal to a2, then the
  559.          value of the function is v2.
  560.  
  561.          SIN(x) -- Sine of x.  Angles are measured in radians.
  562.  
  563.          SINH(x) -- Hyperbolic sine of x.
  564.  
  565.          SQRT(x) -- Square root of x.
  566.  
  567.          STEP(a,x) -- Step function.  If x is less than  a,  the  value  of
  568.          the  function is 0.  If x is greater than or equal to a, the value
  569.          of the function is 1.  If you need a function which is 1 up  to  a
  570.          certain  value  and  then  0 beyond that value, use the expression
  571.          STEP(x,a).  See PIECE.NLR for an example of this function.
  572.  
  573.          T(n,x) -- Chebyshev polynomial of order n.
  574.  
  575.          TAN(x) -- Tangent of x.  Angles are measured in radians.
  576.  
  577.          TANH(x) -- Hyperbolic tangent of x.
  578.  
  579.          Y0(x) -- Bessel function of the second kind, order zero.
  580.  
  581.          Y1(x) -- Bessel function of the second kind, order one.
  582.  
  583.          YN(n,x) -- Bessel function of the second kind, order n.
  584.  
  585.          2.2 Nonlin Command Files
  586.  
  587.          The commands described in this section are  placed  in  a  command
  588.          file.   When you start Nonlin, you specify the name of the command
  589.          file as a parameter on the command  line.   For  example,  if  the
  590.          command  file  name  is CAR.NLR, the following command would cause
  591.          Nonlin to execute the commands in the command file:
  592.  
  593.               NONLIN CAR.NLR
  594.  
  595.          If you do not specify a file name extension for the command  file,
  596.          ".NLR"  is used by default.  The output of the regression for this
  597.          example would be written to a file named CAR.LST.   Command  files
  598.          can  be  created  using  a text editor such as EDIT-32, EDLIN, the
  599.          DOS version 5 EDIT program, or any other editor or word  processor
  600.          that  is capable of creating an ascii text file without formatting
  601.          codes.
  602.  
  603.          Comments may be placed in command files by preceding  the  comment
  604.          with  an exclamation point.  Entire lines may be used for comments
  605.          and comments can be placed at the end of commands.
  606.  
  607.          Command lines can be continued by placing  a  semicolon  character
  608.          as  the last non-blank character on the line (a comment may follow
  609.  
  610.          Chapter 2. Using Nonlin                                         10
  611.  
  612.  
  613.          the semicolon) and then continuing the command  on  the  following
  614.          line(s).
  615.  
  616.          Every   command   file   must   contain  the  following  commands:
  617.          VARIABLES, PARAMETERS, FUNCTION, and  DATA.   The  DATA  statement
  618.          introduces  the data for the analysis and must be the last command
  619.          in the file  (data  records  may  follow  it).   Other,  optional,
  620.          commands  may  be interspersed in the command file.  The following
  621.          is an example of a complete command file:
  622.  
  623.               VARIABLES  VALUE,AGE,MILES
  624.               PARAMETERS BASE,DEPAGE,DEPMILES
  625.               FUNCTION VALUE = BASE + DEPAGE*AGE + DEPMILES*MILES
  626.               DATA
  627.               (data records follow)
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.                                      Chapter 3
  635.  
  636.                                   Nonlin Commands
  637.  
  638.  
  639.  
  640.  
  641.          The following is a list of the valid Nonlin commands that  can  be
  642.          placed  in  a  Nonlin  command  file.   Command  keywords  may  be
  643.          abbreviated to  the  first  three  letters  except  for  CONSTANT,
  644.          CONSTRAIN,  and  CONFIDENCE  which  require  six  letters.  Nonlin
  645.          commands are not case sensitive.
  646.  
  647.          3.1 TITLE
  648.  
  649.          TITLE string (optional) -- Specifies a title line that is  printed
  650.          with the results of the analysis.
  651.  
  652.          3.2 VARIABLES
  653.  
  654.          VARIABLES  var1,var2,...  (required) -- Specifies the names of the
  655.          variables that will  be  used  in  the  function.   The  dependent
  656.          variable  and  the  independent  variables must be specified.  The
  657.          order of the variable names must  match  the  order  of  the  data
  658.          values  on  each  observation  record  (the dependent variable may
  659.          come before or after the independent variables).  You  may  define
  660.          more   variables   than   you   actually   use   in  the  function
  661.          specification.  A maximum of 12 variables may be  specified.   The
  662.          length   of   a   variable  name  is  limited  to  10  characters.
  663.          Capitalize the variable names as you want them  displayed  in  the
  664.          results.
  665.  
  666.          You  may  specify  all  of  the variables on a single command line
  667.          (which may be  continued),  or  you  may  use  multiple  VARIABLES
  668.          commands.   If  you use multiple commands, the order in which they
  669.          appear in the command file must match the order  of  the  variable
  670.          values  on  each  observation  record.  The VARIABLES command must
  671.          precede the FUNCTION command.  See F33.NLR for  an  example  of  a
  672.          multiple regression using three independent variables.
  673.  
  674.          3.3 PARAMETERS
  675.  
  676.          PARAMETERS  param1[=initial1],param2[=initial2],...  (required) --
  677.          Specifies the names of the  parameters  whose  values  are  to  be
  678.          determined  by  Nonlin.   Nonlin  is  capable of handling up to 12
  679.          parameters.  The parameter names may not exceed 10  characters  in
  680.          length.   Do  not  specify any parameters that are not used in the
  681.          function.   The  PARAMETERS  command  must  precede  the  FUNCTION
  682.          command.
  683.  
  684.  
  685.  
  686.                                          11
  687.  
  688.          Chapter 3. Nonlin Commands                                      12
  689.  
  690.  
  691.          Optionally,  an  initial  estimate  of  the parameter value may be
  692.          specified by following the parameter name with an equal  sign  and
  693.          the  value.   If  no  value  is  specified,  1 is used by default.
  694.          Specifying an initial value that is near the actual value  usually
  695.          speeds   up   the  operation  of  Nonlin  and  may  enable  it  to
  696.          successfully converge to a  solution.   If  Nonlin  is  unable  to
  697.          converge  to  a solution, try specifying different starting values
  698.          for the parameters.  Try to specify a value that at least has  the
  699.          correct sign as the expected final value.
  700.  
  701.          The  CONSTRAIN  command  (see  page  13)  can be used to limit the
  702.          range of values for parameters.  The SWEEP command (see  page  13)
  703.          can  be  used  to  perform the regression analysis with a range of
  704.          parameter initial values.  The CONSTANT command  can  be  used  to
  705.          define a parameter with a fixed value.
  706.  
  707.          3.4 CONFIDENCE
  708.  
  709.          CONFIDENCE  [percent]  (optional)  --  Specifies that a confidence
  710.          interval is to be  printed  for  each  estimated  parameter.   The
  711.          purpose  of  regression analysis is to determine the best estimate
  712.          of  parameter  values.   However,   as   with   most   statistical
  713.          calculations,  the  values  determined  are  estimates of the true
  714.          values.  The CONFIDENCE command causes Nonlin  to  print  a  table
  715.          showing  the  range  of possible values for each parameter given a
  716.          specified confidence value.   The  "percent"  parameter  specifies
  717.          the  probability  that  that  the actual value of the parameter is
  718.          within the confidence interval to be computed.  For  example,  the
  719.          command
  720.  
  721.               CONFIDENCE 95
  722.  
  723.          specifies  that the confidence interval(s) are to be computed such
  724.          that there is a 95 percent probability that the actual  values  of
  725.          the  parameters  are  within  the  intervals (or that there is a 5
  726.          percent chance that the parameters  are  outside  the  intervals).
  727.          The  "percent"  parameter  may  range  from  50 to 99.999.  If the
  728.          CONFIDENCE command is used without specifiying  a  percent  value,
  729.          90 is used by default.
  730.  
  731.          3.5 CONSTANT
  732.  
  733.          CONSTANT  parameter=value  (optional)  --  Specifies the name of a
  734.          symbolic constant and associates a numeric value.   You  may  then
  735.          use  the  symbolic  name  in  the  function  and the corresponding
  736.          constant numeric value will be substituted.  This is  useful  when
  737.          you  are trying out different models and want to easily be able to
  738.          change a constant value for each run.  The CONSTANT commands  must
  739.          precede  the  FUNCTION  command.  The following is an example of a
  740.          symbolic constant named "Roomtemp" that causes the value 73 to  be
  741.          substituted in the function:
  742.  
  743.          Chapter 3. Nonlin Commands                                      13
  744.  
  745.  
  746.               Variable Time            ! Cooling time in seconds
  747.               Variable Temp            ! Temperature of object
  748.               Constant Roomtemp = 73        ! Ambient temperature
  749.               Parameter InitTemp        ! Initial temperature
  750.               Parameter Coolrate        ! Cooling rate factor
  751.               Function Temp = Roomtemp + InitTemp * exp(-Coolrate * Time)
  752.  
  753.          3.6 CONSTRAIN
  754.  
  755.          CONSTRAIN  parameter=lowvalue,highvalue  (optional) -- Specifies a
  756.          lower and upper limit on the range of a parameter  value.   During
  757.          the  solution  process,  Nonlin  may  allow a parameter's value to
  758.          temporarily move in a direction away from its final  value.   With
  759.          some  functions  it  may be necessary to constrain the parameter's
  760.          value so that it does not  go  negative  (e.g.,  if  the  function
  761.          takes  the  square  root  of  the  parameter),  or  zero  (if  the
  762.          parameter is  in  a  denominator).   If  a  parameter  is  tightly
  763.          constrained,  Nonlin  may report "singular convergence" because it
  764.          is unable to converge  to  an  optimum  value  of  the  parameter;
  765.          however, the estimated values of other parameters may be useful.
  766.  
  767.          Only   a  single  parameter  and  its  associated  limits  may  be
  768.          specified on each CONSTRAIN command,  but  you  may  use  multiple
  769.          CONSTRAIN  commands.   The  PARAMETERS  command  must  precede the
  770.          CONSTRAIN command.  Use  the  CONSTANT  command  if  you  wish  to
  771.          define a parameter with a fixed value.
  772.  
  773.          The  parameter  value  is  allowed  to  range  from  `lowvalue' to
  774.          `highvalue'.  If you want to prevent a parameter value from  going
  775.          to  zero,  you  must specify a value greater than zero for the low
  776.          value (specifying zero would allow it to reach, but not go  below,
  777.          zero).   For  example,  the following command constrains the value
  778.          of `age' to be greater than zero and less than or equal to 100:
  779.  
  780.               CONSTRAIN age = .0001,100
  781.  
  782.          See the COOLING.NLR, F33EXP.NLR, and POWER.NLR files for  examples
  783.          of the CONSTRAIN command.
  784.  
  785.          3.7 COVARIANCE
  786.  
  787.          COVARIANCE  (optional)  --  Causes  the variance-covariance matrix
  788.          for the parameters to be printed.
  789.  
  790.          3.8 SWEEP
  791.  
  792.          SWEEP    parameter=lowvalue,highvalue,stepsize    (optional)    --
  793.          Specifies   that  the  regression  analysis  is  to  be  performed
  794.          repeatedly with a set of starting values for the  parameter.   The
  795.          first   analysis  is  performed  with  the  parameter  having  the
  796.          `lowvalue';  the  value  of  `stepsize'  is  then  added  to   the
  797.          parameter's  initial  value  and  the analysis is performed again.
  798.          The process is repeated until the value of the  parameter  reaches
  799.          `highvalue'.
  800.  
  801.          Chapter 3. Nonlin Commands                                      14
  802.  
  803.  
  804.          Each  time the analysis is performed the value of the residual sum
  805.          of squares  is  compared  with  the  best  previous  result.   The
  806.          estimated  values  of  the  parameters for the best starting value
  807.          are saved and used for the final analysis and report.
  808.  
  809.          Only one parameter may be specified on  each  SWEEP  command,  but
  810.          you  may have as many SWEEP commands as there are parameters.  The
  811.          number of regression analyses  performed  will  be  equal  to  the
  812.          product of the number of parameter values for each SWEEP command.
  813.  
  814.          The  SWEEP  command  is  useful  when  you  are  trying  to  fit a
  815.          complicated function that may have "local  minimum"  values  other
  816.          than  the  "global  minimum".  Periodic functions (sin, cos, etc.)
  817.          are especially troublesome.
  818.  
  819.          See the  SINE.NLR  command  file  for  an  example  of  the  SWEEP
  820.          command.
  821.  
  822.          3.9 FUNCTION
  823.  
  824.          FUNCTION  depvar  =  function  (required) -- Specifies the form of
  825.          the  function  whose  parameters  are  to  be   determined.    The
  826.          dependent  variable  must  be  the  only  thing to the left of the
  827.          equal sign.  The expression to the right of  the  equal  sign  may
  828.          contain  variables,  parameters, constants, operators, and library
  829.          functions  such  as  sqrt,  sin,  exp,  etc.   The  VARIABLES  and
  830.          PARAMETERS  commands must have appeared in the command file before
  831.          the FUNCTION command, and all variables  and  parameters  used  in
  832.          the  function  must  have  been specified on those commands.  Some
  833.          example FUNCTION commands are show below:
  834.  
  835.               FUNCTION  Y = P0 + P1*X
  836.  
  837.               FUNCTION  DISTANCE = .5 * ACCEL * TIME^2
  838.  
  839.               FUNCTION  VALUE = PRICE + YRDEP*AGE + MILEDEP*MILES
  840.  
  841.               FUNCTION  POPULATN = BASE * GROWRATE * EXP(TIME)
  842.  
  843.          3.10 TOLERANCE
  844.  
  845.          TOLERANCE  value  (optional,  default=1E-10)  --   Specifies   the
  846.          tolerance  factor that is used to determine when the algorithm has
  847.          converged  to  a  solution.   Reducing  the  tolerance  value  may
  848.          produce  a  slightly  more  accurate  result but will increase the
  849.          number of iterations and the running time.   The  tolerance  value
  850.          must be in the range 1E-15 to 1E-1.
  851.  
  852.          3.11 ITERATIONS
  853.  
  854.          ITERATIONS  value  (optional, default=50) -- Specifies the maximum
  855.          number of iterations that should be attempted  by  the  algorithm.
  856.          If  the  solution  does not converge to the limit specified by the
  857.          TOLERANCE  command  (or  to  the  default  tolerance)  before  the
  858.          maximum  number  of  iterations is reached, the process is stopped
  859.  
  860.          Chapter 3. Nonlin Commands                                      15
  861.  
  862.  
  863.          and the results are  printed.   Failure  to  converge  before  the
  864.          specified  number  of  iterations  could be caused by one of three
  865.          things:
  866.  
  867.          1.  The maximum allowed number of iterations  may  be  too  small.
  868.          Try using an ITERATIONS command with a larger value.
  869.  
  870.          2.   The  tolerance  factor  may  be  too  small.  Even a properly
  871.          converging solution  will  eventually  "level  off"  or  oscillate
  872.          around  a good, but non-zero, sum of squares value.  Try using the
  873.          TOLERANCE command to increase the tolerance value.
  874.  
  875.          3.  The function may not be  converging.   Try  specifying  better
  876.          (or  at least different) starting values for the parameters on the
  877.          PARAMETERS command.  Consider using the SWEEP command  to  specify
  878.          a range of parameter starting values.
  879.  
  880.          3.12 REGISTER
  881.  
  882.          REGISTER   (optional)  --  The  REGISTER  command  suppresses  the
  883.          copyright and registration message that is  otherwise  written  to
  884.          the  listing  file  generated  by the shareware version of Nonlin.
  885.          The REGISTER command  performs  no  function  for  the  registered
  886.          version  of  Nonlin.   The  use of this command is a reminder that
  887.          you should register your use of Nonlin.  Note, if you find  Nonlin
  888.          to  be  useful,  educational,  or entertaining you are expected to
  889.          register your use so that the author  can  be  justly  compensated
  890.          and  that  development  of the program can continue.  Use the form
  891.          in REGISTER.DOC (or on page 40) to register your use.
  892.  
  893.          3.13 OUTPUT
  894.  
  895.          OUTPUT [TO  file]  var1,var2,...   (optional)  --  Specifies  that
  896.          after  the analysis is completed, data values are to be printed or
  897.          written to a file.  If the "TO file" portion  of  the  command  is
  898.          specified,  the  output is written to the specified file.  If this
  899.          portion of the command is omitted, the output values  are  printed
  900.          along  with  the  results.  If a file name is specified without an
  901.          extension, ".OUT" is used by default.
  902.  
  903.          The list of variable names determines which variables are  written
  904.          to  the  file  and  the  order  in which the values appear in each
  905.          output record.  Any variable previously declared  on  a  VARIABLES
  906.          command  may  be  specified.   In  addition, the following special
  907.          variable names may appear in the output list:
  908.  
  909.          $OBS  --  The  observation  record  number,  starting  at  1   and
  910.          increasing by 1.
  911.  
  912.          $PREDICTED  --  The predicted value for the dependent variable for
  913.          the observation, given the independent  variable  values  and  the
  914.          parameters as calculated by the analysis.
  915.  
  916.          $RESIDUAL  --  The  difference  between  the  actual  value of the
  917.          dependent variable and its predicted value.
  918.  
  919.          Chapter 3. Nonlin Commands                                      16
  920.  
  921.  
  922.          Examples of OUTPUT commands are shown below:
  923.  
  924.               OUTPUT AGE,MILES,VALUE,$PREDICTED,$RESIDUAL
  925.               OUTPUT TO GROWTH.DAT $OBS,TIME,POPULATN,$PREDICTED
  926.  
  927.          3.14 POUTPUT
  928.  
  929.          POUTPUT file (optional) --  The  POUTPUT  command  specifies  that
  930.          Nonlin  is  to  write the final estimated values of the parameters
  931.          to a file.  Each parameter value is written to a separate line  of
  932.          the  file.   This  command is useful to create a file of estimated
  933.          parameter values to be fed into another  analysis  program.   This
  934.          command  can  also be used to determine the parameter estimates to
  935.          more significant digits than  displayed  in  the  printed  listing
  936.          because  the  format used by the POUTPUT command writes the values
  937.          with 18 significant digits.
  938.  
  939.          3.15 PLOT
  940.  
  941.          PLOT [options] (optional) -- Display  a  plot  of  the  calculated
  942.          function  and  the  data  observations.  The PLOT command can only
  943.          handle  a  single  independent  variable   (multiple   independent
  944.          variables  would  require an n-dimensional surface plot); however,
  945.          there  is  no  restriction  on  the  number  of  parameters  being
  946.          estimated.
  947.  
  948.          You  must have a CGA, EGA, or VGA monitor to use the PLOT command,
  949.          and the NONLIN.FON font file must be in the current  directory  or
  950.          in  a  directory specified by the NONLIN environment variable.  In
  951.          the plot, the data values you provided are shown as blue  X's  and
  952.          the  function  fitted  to  the  data by Nonlin is shown as a solid
  953.          green line.  Press Return to proceed with the analysis  after  you
  954.          have finished looking at the plot.
  955.  
  956.          The following options may be specified on the PLOT command:
  957.  
  958.          GRID -- display grid lines to make it easier to estimate values.
  959.  
  960.          RESIDUAL  --  draw vertical lines from each observed data point to
  961.          the corresponding point on the calculated  function  line.   These
  962.          lines  represent the "residual" value that Nonlin is attempting to
  963.          minimize.  See also  the  descriptions  of  the  RPLOT  and  NPLOT
  964.          commands on pages 17 and 18.
  965.  
  966.          ITERATION  --  draw  a  plot  for each iteration of the regression
  967.          analysis.  Normally, the plot is  drawn  after  the  analysis  has
  968.          converged  to  a  solution;  you  may  use the ITERATION option to
  969.          observe the function during each iteration of the analysis  as  it
  970.          converges to fit the data.
  971.  
  972.          VALUES  --  use  in conjunction with the ITERATION option to cause
  973.          the current parameter values to be displayed before the  plot  for
  974.          the current iteration.
  975.  
  976.          Chapter 3. Nonlin Commands                                      17
  977.  
  978.  
  979.          PRINT  --  print  a  copy  of  the plot on an HP LaserJet printer.
  980.          This option  is  only  available  in  the  registered  version  of
  981.          Nonlin.   Nonlin  writes  the plot to the PRN device which much be
  982.          attached  to  an  HP  Series  II  or  Series  III  printer.    The
  983.          NONLIN.LJF  font  file  must  be  in the current directory or in a
  984.          directory specified by the NONLIN environment variable.
  985.  
  986.          NOPAUSE -- do not pause after the plot  is  displayed.   Normally,
  987.          Nonlin  pauses  after  displaying  a  plot  to  allow  you time to
  988.          examine it; you press Enter to continue execution  once  you  have
  989.          finished  looking  at  the plot.  The NOPAUSE option causes Nonlin
  990.          to continue with execution  without  pausing  after  the  plot  is
  991.          displayed.   This  is  useful in conjunction with the PRINT option
  992.          when Nonlin is run in a batch file and  you  want  to  generate  a
  993.          hardcopy plot but not pause after the screen display.
  994.  
  995.          The  option keywords may be abbrievated to their first letter.  If
  996.          more than one option is  specified,  separate  them  with  commas.
  997.          For  example,  to produce a plot with both grid lines and residual
  998.          lines, use the following command:
  999.  
  1000.               PLOT GRID,RESIDUAL
  1001.  
  1002.          3.16 RPLOT
  1003.  
  1004.          RPLOT [options] (optional) --  Display  a  plot  of  the  residual
  1005.          values.    A   "residual"   value  (or  error  deviation)  is  the
  1006.          difference between an actual value of the dependent  variable  for
  1007.          an  observation  and  the  predicted  value  based on the function
  1008.          fitted by the regression analysis.   If  the  calculated  function
  1009.          exactly  predicted  the  actual  observation  values,  all  of the
  1010.          residual values would be zero.  However, this is usually  not  the
  1011.          case  and  the  residual  values  show where, and by how much, the
  1012.          fitted function fails to predict the actual observations.
  1013.  
  1014.          The RPLOT command causes Nonlin to  display  a  plot  showing  the
  1015.          residual  values  on  the  vertical  (Y)  axis and the independent
  1016.          variable values on the horizontal (X) axis.  However, if there  is
  1017.          more  than  one independent variable, Nonlin displays the residual
  1018.          values on the vertical (Y) axis and the dependent variable  values
  1019.          on  the  horizontal  (X)  axis.   The  plot title indicates if the
  1020.          dependent variable was used for the X axis.
  1021.  
  1022.          A residual plot is very useful for determining if the form of  the
  1023.          function  being fitted is appropriate for the data values.  If the
  1024.          residual values are randomly distributed in positive and  negative
  1025.          directions  then  the  form  (shape)  of  the  fitted  function is
  1026.          probably appropriate for the data and the deviations  are  due  to
  1027.          random  measurement  errors.   If,  however,  the residuals show a
  1028.          systematic pattern such as a periodic  cycle,  then  the  function
  1029.          may  not  be  appropriate for the data values.  See the discussion
  1030.          of the Durbin-Watson  statistic  in  Section  4.9,  page  23,  for
  1031.          additional  information about autocorrelated residual values.  The
  1032.          PLOT, RPLOT, and NPLOT commands may be used in  the  same  command
  1033.  
  1034.          Chapter 3. Nonlin Commands                                      18
  1035.  
  1036.  
  1037.          file.   Press  Return  to proceed with the analysis after you have
  1038.          finished looking at the plot.
  1039.  
  1040.          The following options may be specified on the RPLOT command:
  1041.  
  1042.          GRID -- display grid lines to make it easier to estimate values.
  1043.  
  1044.          PRINT -- print a copy of the  plot  on  an  HP  LaserJet  printer.
  1045.          This  option  is  only  available  in  the  registered  version of
  1046.          Nonlin.  Nonlin writes the plot to the PRN device  which  much  be
  1047.          attached to an HP Series II or Series III printer.
  1048.  
  1049.          NOPAUSE  --  do  not pause after the plot is displayed.  Normally,
  1050.          Nonlin pauses after  displaying  a  plot  to  allow  you  time  to
  1051.          examine  it;  you  press Enter to continue execution once you have
  1052.          finished looking at the plot.  The NOPAUSE  option  causes  Nonlin
  1053.          to  continue  with  execution  without  pausing  after the plot is
  1054.          displayed.
  1055.  
  1056.          The option keywords may be abbrievated to their first letter.   If
  1057.          more than one option is specified, separate them with commas.
  1058.  
  1059.          3.17 NPLOT
  1060.  
  1061.          NPLOT  [options]  (optional)  -- Display a normal probability plot
  1062.          of the residual values.  In this plot, the actual  value  of  each
  1063.          residual  is  plotted  on  the  vertical (Y) axis and the expected
  1064.          value  of  the  residual,  assuming  the  residuals  are  normally
  1065.          distributed,  is  plotted  on  the  horizontal  (X)  axis.  If the
  1066.          residuals are normally distributed, the resulting plot will  be  a
  1067.          straight  line passing through the origin with a slope of 1 (i.e.,
  1068.          the actual value of each residual should equal the expected  value
  1069.          from  the normal distribution).  If the residuals are not normally
  1070.          distributed, the plot will deviate from a straight line.
  1071.  
  1072.          This  plot  also  computes  the  correlation  between  the  actual
  1073.          residual  values  and  their  expected  values  and  displays  the
  1074.          correlation coefficient in the  title  line  "(r=n.nn)".   If  the
  1075.          residual  values  are normally distributed, the correlation should
  1076.          be close to 1.00.  A correlation value  less  than  0.94  suggests
  1077.          that the residuals are not normally distributed.
  1078.  
  1079.          The  NPLOT  command  may  be  used  even if there is more than one
  1080.          independent variable.  The PLOT, RPLOT, and NPLOT commands may  be
  1081.          used  in  the same command file.  Press Return to proceed with the
  1082.          analysis after you have finished looking at the plot.
  1083.  
  1084.          The following options may be specified on the NPLOT command:
  1085.  
  1086.          GRID -- display grid lines to make it easier to estimate values.
  1087.  
  1088.          PRINT -- print a copy of the  plot  on  an  HP  LaserJet  printer.
  1089.          This  option  is  only  available  in  the  registered  version of
  1090.          Nonlin.  Nonlin writes the plot to the PRN device  which  much  be
  1091.          attached to an HP Series II or Series III printer.
  1092.  
  1093.          Chapter 3. Nonlin Commands                                      19
  1094.  
  1095.  
  1096.          NOPAUSE -- do not pause after the plot is displayed.
  1097.  
  1098.          The  option keywords may be abbrievated to their first letter.  If
  1099.          more than one option is specified, separate them with commas.
  1100.  
  1101.          DOMAIN lowvalue,highvalue (optional) -- Specifies the domain  over
  1102.          which  the  plot  is  to be generated.  If the DOMAIN statement is
  1103.          omitted, the domain of the independent variable is  used  for  the
  1104.          plot.   The DOMAIN statement can be used to generate a plot of the
  1105.          fitted function extrapolated over the specified domain.   You  can
  1106.          also  use  the DOMAIN command to restrict the domain and "zero in"
  1107.          on a particular range of the function.  The  DOMAIN  command  only
  1108.          affects  the  PLOT  command;  it  does  not  affect the regression
  1109.          calculation or the RPLOT or NPLOT commands.
  1110.  
  1111.          3.18 PRESOLUTION
  1112.  
  1113.          PRESOLUTION value (optional) -- Specifies whether  plots  sent  to
  1114.          HP   LaserJet   printers   should  use  150  or  300  dot-per-inch
  1115.          resolution.  This option  is  only  available  in  the  registered
  1116.          version  of  Nonlin.  The value parameter must be 150 or 300.  The
  1117.          default value  is  150  causes  the  plots  to  use  most  of  the
  1118.          horizontal  width  of  an  8.5x11  inch  page.   These  plots  are
  1119.          suitable  for  direct   transfer   to   overhead   transparencies.
  1120.          Specifying  300 for the resolution produces smaller plots that are
  1121.          suitable for inclusion in printed documents.
  1122.  
  1123.          3.19 WIDTH
  1124.  
  1125.          WIDTH value  (optional)  --  Specify  the  width,  in  inches,  of
  1126.          printed  plots.   This  option is only available in the registered
  1127.          version of  Nonlin.   Due  to  memory  space  considerations,  the
  1128.          maximum  width  is  limited  to  about  7.9  inches  for  150  DPI
  1129.          resolution and 4.5 inches for 300 DPI  resolution.   If  you  have
  1130.          limited  memory space, you may have to reduce the width to be able
  1131.          to produce printed plots.  This statement is  ignored  unless  you
  1132.          request that a plot be printed.
  1133.  
  1134.          3.20 DATA
  1135.  
  1136.          DATA   [file]  (required)  --  Specifies  the  name  of  the  file
  1137.          containing the data records, or introduces the data records  which
  1138.          follow  the  command.   If  a  file  name is specified on the DATA
  1139.          command, the file is opened, its data records are  read,  and  the
  1140.          regression  analysis  is  performed.   If a file name is specified
  1141.          without an extension, ".DAT" is used by default.
  1142.  
  1143.          If no file name  is  specified  on  the  DATA  command,  the  data
  1144.          records  must  immediately  follow the DATA command in the command
  1145.          file.
  1146.  
  1147.          Each data record must contain at least as many data values as  the
  1148.          number  of  variables  specified on the VARIABLES command(s).  The
  1149.          order of the variables as specified on the VARIABLES command  must
  1150.          match  the  order  of  the  values  in each observation.  Any data
  1151.  
  1152.          Chapter 3. Nonlin Commands                                      20
  1153.  
  1154.  
  1155.          values beyond those  required  for  the  specified  variables  are
  1156.          ignored.  Each observation must begin on a new line.
  1157.  
  1158.          The  data  values must be separated by one or more spaces and/or a
  1159.          comma.   Data  values  may  contain  decimal  points  and  may  be
  1160.          expressed  in  exponential  notation  (i.e.,  n.nnnnEppp).   As  a
  1161.          convenience for entering time values, if a value contains  one  or
  1162.          more  colons,  the  portion to the left of the colon is multiplied
  1163.          by 60.   For  example,  1:00  is  equivalent  to  60;  1:00:00  is
  1164.          equivalent to 3600.
  1165.  
  1166.          You  may continue data lines by specifying a semicolon as the last
  1167.          non-blank character on a record and then placing the  continuation
  1168.          value on the following line(s).
  1169.  
  1170.          The  DATA  command  must  be the last command in the command file.
  1171.          If no file name  is  specified  on  the  DATA  command,  the  data
  1172.          records  must  immediately  follow the DATA command in the command
  1173.          file.  The following is an example  of  a  complete  command  file
  1174.          including data records:
  1175.  
  1176.               VARIABLES AGE,MILES,VALUE
  1177.               PARAMETERS BASE,DEPAGE,DEPMILES
  1178.               FUNCTION VALUE = BASE + DEPAGE*AGE + DEPMILES*MILES
  1179.               DATA
  1180.               2  10000  13000
  1181.               4  42000   9000
  1182.               1   7000  17000
  1183.               6  52000   6000
  1184.               5  48000   8000
  1185.  
  1186.          If  the  data  records  had  been  placed in a separate file named
  1187.          CAR.DAT, the DATA statement would be changed to "DATA CAR.DAT".
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.                                      Chapter 4
  1195.  
  1196.                              Understanding The Results
  1197.  
  1198.  
  1199.  
  1200.  
  1201.          4.1 Descriptive Statistics for Variables
  1202.  
  1203.          Nonlin  prints  a  variety  of  statistics  at  the  end  of  each
  1204.          analysis.   For each variable, Nonlin lists the minimum value, the
  1205.          maximum value, the mean value, and the  standard  deviation.   You
  1206.          should  confirm  that  these  values  are  within  the  ranges you
  1207.          expect.
  1208.  
  1209.          4.2 Parameter Estimates
  1210.  
  1211.          For  each  parameter,  Nonlin  displays  the   initial   parameter
  1212.          estimate  (which  you  specified on the PARAMETER command, or 1 by
  1213.          default), the final (maximum likelihood)  estimate,  the  standard
  1214.          error   of  the  estimated  parameter  value,  the  "t"  statistic
  1215.          comparing  the  estimated  parameter  value  with  zero,  and  the
  1216.          significance  of  the  t  statistic.   Nine significant digits are
  1217.          displayed for the parameter estimates.  If you need  to  determine
  1218.          the parameters to greater precision, use the POUTPUT command.
  1219.  
  1220.          The  final  estimate  parameter  values  are  the  results  of the
  1221.          analysis.  By  substituting  these  values  in  the  equation  you
  1222.          specified  to be fitted to the data, you will have a function that
  1223.          can be used to predict the value of the dependent  variable  based
  1224.          on  a  set  of values for the independent variables.  For example,
  1225.          if the equation being fitted is
  1226.  
  1227.               y = p0 + p1*x
  1228.  
  1229.          and the final estimates are 1.5 for p0 and  3  for  p1,  then  the
  1230.          equation
  1231.  
  1232.               y = 1.5 + 3*x
  1233.  
  1234.          is  the  best equation of this form that will predict the value of
  1235.          y based on the value of x.
  1236.  
  1237.          4.3 t Statistic
  1238.  
  1239.          The "t" statistic is computed by dividing the estimated  value  of
  1240.          the  parameter by its standard error.  This statistic is a measure
  1241.          of the likelihood that the actual value of the  parameter  is  not
  1242.          zero.   The  larger  the absolute value of t, the less likely that
  1243.          the actual value of the parameter could be zero.
  1244.  
  1245.  
  1246.                                          21
  1247.  
  1248.          Chapter 4. Understanding The Results                            22
  1249.  
  1250.  
  1251.          4.4 Prob(t)
  1252.  
  1253.          The "Prob(t)" value is the probability of obtaining the  estimated
  1254.          value  of  the  parameter  if  the actual parameter value is zero.
  1255.          The smaller  the  value  of  Prob(t),  the  more  significant  the
  1256.          parameter  and  the less likely that the actual parameter value is
  1257.          zero.  For example, assume the estimated value of a  parameter  is
  1258.          1.0  and  its  standard  error  is 0.7.  Then the t value would be
  1259.          1.43 (1.0/0.7).  If the computed Prob(t) value was 0.05 then  this
  1260.          indicates  that  there  is only a 0.05 (5%) chance that the actual
  1261.          value of the parameter could be zero.  If Prob(t) was  0.001  this
  1262.          indicates  there is only 1 chance in 1000 that the parameter could
  1263.          be zero.  If Prob(t) was 0.92 this indicates that there is  a  92%
  1264.          probability  that the actual value of the parameter could be zero;
  1265.          this implies that the term of the regression  equation  containing
  1266.          the  parameter  can  be eliminated without significantly affecting
  1267.          the accuracy of the regression.
  1268.  
  1269.          The t statistic probability is computed using  a  two-sided  test.
  1270.          The  CONFIDENCE  command  can  be  used  to  cause Nonlin to print
  1271.          confidence  intervals  for  parameter  values.    The   SQUARE.NLR
  1272.          example  regression  includes  an  extraneous parameter (p0) whose
  1273.          estimated value is much  smaller  than  its  standard  error;  the
  1274.          Prob(t)   value  is  0.99982  indicating  that  there  is  a  high
  1275.          probability that the value is zero.
  1276.  
  1277.          4.5 Final Sum of Squared Deviations
  1278.  
  1279.          In addition to the variable and parameter values, Nonlin  displays
  1280.          several  statistics  that  indicate how well the equation fits the
  1281.          data.  The "Final sum of squared deviations" is  the  sum  of  the
  1282.          squared  differences  between  the  actual  value of the dependent
  1283.          variable for each observation  and  the  value  predicted  by  the
  1284.          function, using the final parameter estimates.
  1285.  
  1286.          4.6 Average and Maximum Deviation
  1287.  
  1288.          The  "Average  deviation"  is the average over all observations of
  1289.          the absolute value of the difference between the actual  value  of
  1290.          the dependent variable and its predicted value.
  1291.  
  1292.          The  "Maximum  deviation  for  any  observation"  is  the  maximum
  1293.          difference (ignoring sign) between the actual and predicted  value
  1294.          of the dependent variable for any observation.
  1295.  
  1296.          4.7 Proportion of Variance Explained
  1297.  
  1298.          The  "Proportion  of  variance explained (R^2)" indicates how much
  1299.          better the function predicts  the  dependent  variable  than  just
  1300.          using  the  mean  value  of  the dependent variable.  This is also
  1301.          known as  the  "coefficient  of  multiple  determination."  It  is
  1302.          computed  as  follows:  Suppose that we did not fit an equation to
  1303.          the  data  and  ignored  all  information  about  the  independent
  1304.          variables  in each observation.  Then, the best prediction for the
  1305.          dependent variable value for any observation  would  be  the  mean
  1306.  
  1307.          Chapter 4. Understanding The Results                            23
  1308.  
  1309.  
  1310.          value  of  the  dependent  variable  over  all  observations.  The
  1311.          "variance" is the sum of the squared differences between the  mean
  1312.          value   and   the   value  of  the  dependent  variable  for  each
  1313.          observation.  Now, if we use our fitted function  to  predict  the
  1314.          value  of  the  dependent  variable,  rather  than  using the mean
  1315.          value, a second kind of variance can be  computed  by  taking  the
  1316.          sum  of  the squared difference between the value of the dependent
  1317.          variable  predicted  by  the  function  and  the   actual   value.
  1318.          Hopefully,  the variance computed by using the values predicted by
  1319.          the function is better (i.e., a smaller value) than  the  variance
  1320.          computed  using  the  mean  value.   The  "Proportion  of variance
  1321.          explained" is computed as 1 - (variance using  predicted  value  /
  1322.          variance  using  mean).   If  the  function perfectly predicts the
  1323.          observed data, the value of this statistic will  be  1.00  (100%).
  1324.          If  the  function does no better a job of predicting the dependent
  1325.          variable than using the mean, the value will be 0.00.
  1326.  
  1327.          4.8 Adjusted Coefficient of Multiple Determination
  1328.  
  1329.          The "adjusted coefficient of multiple determination (Ra^2)" is  an
  1330.          R^2  statistic  adjusted  for  the  number  of  parameters  in the
  1331.          equation and the number  of  data  observations.   It  is  a  more
  1332.          conservative  estimate  of  the  percent  of  variance  explained,
  1333.          especially when the sample size is small compared  to  the  number
  1334.          of parameters.  It is computed using the formula:
  1335.  
  1336.               Ra^2 = 1 - (n-1)/(n-p) * (1-R^2)
  1337.  
  1338.          where  `n'  is  the  number  of observations, `p' is the number of
  1339.          parameters, and `R^2' is the unadjusted  coefficient  of  multiple
  1340.          determination.
  1341.  
  1342.          4.9 Durbin-Watson Statistic
  1343.  
  1344.          The  "Durbin-Watson  test for autocorrelation" is a statistic that
  1345.          indicates the likelihood that the  deviation  (error)  values  for
  1346.          the  regression  have a first-order autoregression component.  The
  1347.          regression  models  assume   that   the   error   deviations   are
  1348.          uncorrelated.
  1349.  
  1350.          In  business  and  economics, many regression applications involve
  1351.          time series data.  If a non-periodic function, such as a  straight
  1352.          line,  is  fitted  to periodic data the deviations have a periodic
  1353.          form and are positively correlated  over  time;  these  deviations
  1354.          are   said   to  be  "autocorrelated"  or  "serially  correlated."
  1355.          Autocorrelated deviations may also indicate that the form  (shape)
  1356.          of  the function being fitted is inappropriate for the data values
  1357.          (e.g., a linear equation fitted to quadratic data).
  1358.  
  1359.          If the deviations are autocorrelated, there may  be  a  number  of
  1360.          consequences   for   the   computed   results:  1)  The  estimated
  1361.          regression  coefficients  no  longer  have  the  minimum  variance
  1362.          property;   2)   the   mean   square  error  (MSE)  may  seriously
  1363.          underestimate the variance of the error  terms;  3)  the  computed
  1364.          standard   error   of   the   estimated   parameter   values   may
  1365.  
  1366.          Chapter 4. Understanding The Results                            24
  1367.  
  1368.  
  1369.          underestimate the true standard error, in which case the t  values
  1370.          and  confidence  intervals  may  be  incorrect.   Note  that if an
  1371.          appropriate periodic function is  fitted  to  periodic  data,  the
  1372.          deviations  from  the  regression will be uncorrelated because the
  1373.          cycle of the data values is accounted for by the fitted function.
  1374.  
  1375.          Small values of the Durbin-Watson statistic indicate the  presence
  1376.          of   autocorrelation.   Consult  significance  tables  in  a  good
  1377.          statistics book for exact interpretations; however, a  value  less
  1378.          than  0.80  usually  indicates that autocorrelation is likely.  If
  1379.          the Durbin-Watson statistic indicates  that  the  residual  values
  1380.          are  autocorrelated,  it  is  recommended  that  you use the RPLOT
  1381.          and/or NPLOT commands to display a plot of the residual values.
  1382.  
  1383.          If an NPLOT command is used to produce a normal  probability  plot
  1384.          of  the residuals, the correlation between the residuals and their
  1385.          expected  values  (assuming  they  are  normally  distributed)  is
  1386.          printed   in   the   listing.    If  the  residuals  are  normally
  1387.          distributed,  the  correlation  should  be  close  to   1.00.    A
  1388.          correlation  less  than  0.94  suggests that the residuals are not
  1389.          normally distributed.
  1390.  
  1391.          4.10 Analysis of Variance Table
  1392.  
  1393.          An "Analysis of Variance"  table  provides  statistics  about  the
  1394.          overall significance of the model being fitted.
  1395.  
  1396.  
  1397.  
  1398.  
  1399.  
  1400.  
  1401.                                      Chapter 5
  1402.  
  1403.                                 Theory of Operation
  1404.  
  1405.  
  1406.  
  1407.  
  1408.          5.1 Minimization Algorithm
  1409.  
  1410.          Nonlin  uses a model/trust-region technique along with an adaptive
  1411.          choice of the model  Hessian.   The  algorithm  is  essentially  a
  1412.          combination   of  Gauss-Newton  and  Levenberg-Marquardt  methods;
  1413.          however, the adaptive  algorithm  often  works  much  better  than
  1414.          either of these methods alone.
  1415.  
  1416.          The  basis  for  the  minimization  technique used by Nonlin is to
  1417.          compute the sum of the squared residuals for one set of  parameter
  1418.          values  and then slightly alter each parameter value and recompute
  1419.          the sum of squared  residuals  to  see  how  the  parameter  value
  1420.          change  affects the sum of the squared residuals.  By dividing the
  1421.          difference between the original and new sum  of  squared  residual
  1422.          values  by the amount the parameter was altered, Nonlin is able to
  1423.          determine the approximate partial derivative with respect  to  the
  1424.          parameter.   This  partial  derivative is used by Nonlin to decide
  1425.          how to alter the value of the parameter for the next iteration.
  1426.  
  1427.          If the function being modeled is well behaved,  and  the  starting
  1428.          value  for  the  parameter  is not too far from the optimum value,
  1429.          the procedure will eventually converge to the  best  estimate  for
  1430.          the  parameter.   This procedure is carried out simultaneously for
  1431.          all  parameters  and  is,  in  fact,  a  minimization  problem  in
  1432.          n-dimensional space, where `n' is the number of parameters.
  1433.  
  1434.          For  a  much more detailed explanation of the regression algorithm
  1435.          used by Nonlin see ACM Transactions on Mathematical  Software  7,3
  1436.          (Sept.   1981)  "Dennis,  J.E., Gay, D.M., and Welsch, R.E.  -- An
  1437.          adaptive nonlinear least-squares algorithm."
  1438.  
  1439.          5.2 Convergence Criterion
  1440.  
  1441.          Nonlin has several convergence criterion that stop  the  iterative
  1442.          minimization  procedure.   The  TOLERANCE  command  can be used to
  1443.          alter the convergence tolerance value.
  1444.  
  1445.          Two internal variables are used to determine when convergence  has
  1446.          occurred.   RFCTOL has a default value of 1E-10 and can be altered
  1447.          by use of the TOLERANCE command.  AFCTOL has a  default  value  of
  1448.          1E-20  and  is  only altered by the TOLERANCE command if the value
  1449.          specified is less than  the  default  value.   In  the  discussion
  1450.  
  1451.  
  1452.  
  1453.                                          25
  1454.  
  1455.          Chapter 5. Theory of Operation                                  26
  1456.  
  1457.  
  1458.          which  follows the "function value" is half the sum of the squared
  1459.          residuals computed using the current parameter estimates.
  1460.  
  1461.          "Relative function  convergence"  is  reported  if  the  predicted
  1462.          maximum  possible  function  reduction  is  at most RFCTOL*ABS(F0)
  1463.          where F0 is the  function  value  at  the  start  of  the  current
  1464.          iteration,  and  if  the last step attempted achieved no more than
  1465.          twice the predicted function decrease.
  1466.  
  1467.          "Absolute function convergence" is reported if the function  value
  1468.          is less than AFCTOL.
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.                                      Chapter 6
  1476.  
  1477.                                 Hints for Nonlin Use
  1478.  
  1479.  
  1480.  
  1481.  
  1482.          6.1 Convergence Failures
  1483.  
  1484.          One  of  the  potential  problems  that  confronts  any  nonlinear
  1485.          minimization procedure  is  non-convergence.   Non-convergence  is
  1486.          usually  not  a  problem for regressions using a linear model, but
  1487.          becomes  a  more  serious  consideration  when  using  complicated
  1488.          nonlinear   functions;   increasing   the   number  of  parameters
  1489.          aggravates the problem.
  1490.  
  1491.          Non-convergence can occur in two ways: the  solution  may  diverge
  1492.          or  it  may  converge  to  the  wrong  solution -- a local minimum
  1493.          rather than the global minimum.  Periodic functions, such as  sin,
  1494.          and  cos,  are  particularly  prone  to convergence problems.  For
  1495.          example,  consider  a  nonlinear  regression  performed  with  the
  1496.          function:
  1497.  
  1498.               y = offset + amplitude * sin(frequency * x)
  1499.  
  1500.          where  x and y are variables, and offset, amplitude, and frequency
  1501.          are the parameters whose values are  to  be  determined.   If  the
  1502.          starting  value  for  frequency  is  not  reasonably  close to the
  1503.          correct value, the solution may converge to a harmonic  (multiple)
  1504.          or  subharmonic  (fundamental)  value of the frequency.  A command
  1505.          file named SINE.NLR is supplied with  the  commands  and  data  to
  1506.          perform this analysis.
  1507.  
  1508.          The  SWEEP  command  can  be  very  useful  in cases like the sine
  1509.          example.  In the SINE.NLR example analysis, the  actual  value  of
  1510.          the  frequency  is  3;  the  function  converges  to  the  correct
  1511.          solution if the starting  value  is  in  the  range  2.6  to  3.3.
  1512.          However,  this  example is quite insensitive to the starting value
  1513.          of the amplitude parameter.   With  an  actual  value  of  2,  the
  1514.          correct  solution  is  found  with  starting values from 1 through
  1515.          10000.  Similarly, the  offset  parameter,  which  had  an  actual
  1516.          value  of  10,  was  successfully  determined with starting values
  1517.          ranging from 1 to over 50000.
  1518.  
  1519.          Another example which is sensitive to a parameter  starting  value
  1520.          is  POWER.NLR  which  attempts  to  determine  the  values  of the
  1521.          parameters p0, p1, and p2 for the function
  1522.  
  1523.               y = p0 + p1*x^p2
  1524.  
  1525.  
  1526.  
  1527.                                          27
  1528.  
  1529.          Chapter 6. Hints for Nonlin Use                                 28
  1530.  
  1531.  
  1532.          (where "x^p2" means x raised to the p2 power).  The  actual  value
  1533.          of  p2  in the example data is 2; the solution converges correctly
  1534.          if the starting value of p2 is in the range 1.8 to 3.8.   As  with
  1535.          the  other  example, the solution is relatively insensitive to the
  1536.          starting values of p0 and p1.
  1537.  
  1538.          6.2 Singular Matrix Problems
  1539.  
  1540.          Another possible problem is that the analysis may  stop  with  the
  1541.          message  "Singular  convergence.  Mutually dependent parameters?".
  1542.          This is usually  due  to  one  of  two  things:  (1)  a  redundant
  1543.          parameter  that  is  co-dependent with another parameter, or (2) a
  1544.          situation where the value of one parameter "blocks" the effect  of
  1545.          other  parameters.   As  an  example  of  a  redundant  parameter,
  1546.          consider the function
  1547.  
  1548.               y = p0 + p1*p2*x
  1549.  
  1550.          This is a simple linear equation except there are two  parameters,
  1551.          p1,  and  p2, which are both factors to the variable x.  It should
  1552.          be clear that there is no unique solution to  this  problem  since
  1553.          any  value  of  p1 is possible if the right value of p2 is chosen.
  1554.          Similarly, the function
  1555.  
  1556.               y = p0 + p1 + p2*x
  1557.  
  1558.          has no unique  solution  since  either  p0  or  p1  is  redundant.
  1559.          Similarly, in the equation
  1560.  
  1561.               y = p0 + p1*exp(x+p2)
  1562.  
  1563.          either p1 or p2 is redundant.
  1564.  
  1565.          The  second  type of singular matrix problem can be illustrated by
  1566.          the function
  1567.  
  1568.               y = p0 + p1*x^p2
  1569.  
  1570.          If, during the solution process, p1 takes on  the  value  0,  then
  1571.          varying  the  value of p2 has no effect on the equation and Nonlin
  1572.          cannot figure out which way to change the  value  of  p2  to  move
  1573.          toward  convergence.   The solution to this problem is to assign a
  1574.          starting value that is not zero  to  p1,  and  use  the  CONSTRAIN
  1575.          command to force p1 to remain non-zero.
  1576.  
  1577.          6.3 Performance Issues
  1578.  
  1579.          Nonlin  is  carefully  programmed  and compiled with an optimizing
  1580.          compiler for maximum  performance.   However,  Nonlin  is  a  real
  1581.          "number  cruncher,"  and  the  nonlinear  regression  algorithm is
  1582.          mathematically very  elaborate.   During  each  iteration,  Nonlin
  1583.          computes  gradients,  Jacobians,  Hessians,  and  eigenvalues, and
  1584.          performs QR and Cholesky matrix decompositions.  All  calculations
  1585.          are carried out using double precision (64 bit) floating point.
  1586.  
  1587.          Chapter 6. Hints for Nonlin Use                                 29
  1588.  
  1589.  
  1590.          Nonlin  does  not  require  an  80x87 numeric coprocessor, but its
  1591.          performance is greatly enhanced if one is present.   In  fact,  an
  1592.          8088  CPU  with an 8087 numeric coprocessor can perform regression
  1593.          analyses faster  than  a  20  MHz  80386  that  does  not  have  a
  1594.          coprocessor.   If  you  have  an  8088  without  a coprocessor, be
  1595.          patient -- Nonlin is probably giving it the workout of its life.
  1596.  
  1597.          Very long running times can result if you use  the  SWEEP  command
  1598.          with  many starting values.  The problem is compounded if you have
  1599.          multiple SWEEP commands.  If you use the SWEEP command  to  try  a
  1600.          large  number  of  starting parameter values, you can save time by
  1601.          using  the  ITERATIONS  command  to  specify  a  small  number  of
  1602.          iterations  (such  as  5)  during  the  initial  attempt to find a
  1603.          solution.  Once a feasible set of starting  parameter  values  has
  1604.          been  determined,  remove  the SWEEP command, specify the starting
  1605.          values  on  the  PARAMETERS  command,  increase  the   number   of
  1606.          iterations, and rerun the analysis to get the final result.
  1607.  
  1608.          6.4 Program Limits
  1609.  
  1610.          The following is a summary of the Nonlin program limitations:
  1611.  
  1612.               Maximum number of variables = 12
  1613.               Maximum number of parameters = 12
  1614.               Maximum length of variable or parameter names = 10
  1615.  
  1616.          The  maximum  number  of  data observations that Nonlin can handle
  1617.          depends on the number of parameters as shown  by  the  table  that
  1618.          follows:
  1619.  
  1620.               # Parameters    Max Observations
  1621.                     1               2019
  1622.                     2               1611
  1623.                     3               1339
  1624.                     4               1144
  1625.                     5                997
  1626.                     6                883
  1627.                     7                791
  1628.                     8                715
  1629.                     9                652
  1630.                    10                599
  1631.  
  1632.          A  commercial version of Nonlin that can handle more variables and
  1633.          parameters is available.  Contact the author for information.
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.                                      Chapter 7
  1641.  
  1642.                                   Example Analyses
  1643.  
  1644.  
  1645.  
  1646.  
  1647.          A number of example regression analysis files  are  provided  with
  1648.          your  Nonlin  distribution.  All of the example command files have
  1649.          the extension ".NLR".  Some of the important  ones  are  described
  1650.          below, others contain comment lines that explain what they do.
  1651.  
  1652.          LINEAR.NLR  --  Simple linear regression with plotted function and
  1653.          data.
  1654.  
  1655.          QUAD.NLR -- Fit a quadratic equation.  Plot the function  and  the
  1656.          data.
  1657.  
  1658.          ASYMPTOT.NLR -- Fit an asymptotic function Y = 12 - 10/X.
  1659.  
  1660.          F33.NLR  --  Multivariate linear regression (multiple regression).
  1661.          Calculate the value of a used Beech F33 Bonanza airplane  using  a
  1662.          linear  model  based  on  its  age,  the  number  of  hours on its
  1663.          airframe, and the number of hours on its engine.  The t value  and
  1664.          Prob(t)  indicate that the number of hours on the engine (`Engdep'
  1665.          parameter) is not significant to the regression model;  the  other
  1666.          parameters  are significant but airframe hours is less significant
  1667.          than the base price and age of the plane.
  1668.  
  1669.          F33YEAR.NLR -- Similar to F33.NLR except the price of the  Bonanza
  1670.          is calculated based on a linear function of only the age.
  1671.  
  1672.          F33EXP.NLR   --   Similar   to   F33YEAR.NLR   except  a  negative
  1673.          exponential function  is  used  rather  than  a  linear  function.
  1674.          Compare  the  fit  of  this  model  with  that  of the F33YEAR.NLR
  1675.          example.
  1676.  
  1677.          SINE.NLR -- Fit an equation involving a sin function.   The  SWEEP
  1678.          command is used to find a starting point that will converge.
  1679.  
  1680.          SQUARE.NLR  --  Fit  a sine series to a square wave.  Note in this
  1681.          example that the 'p0' parameter,  which  represents  the  constant
  1682.          term  of  the  equation,  has  an  estimated value of 9.22715E-006
  1683.          (very nearly zero)  and  a  standard  error  of  0.0398754.   This
  1684.          yields  a  t  value  of  nearly  zero and Prob(t) of 0.99982 which
  1685.          means that there is a 99.982% chance that the actual value  of  p0
  1686.          may  be  zero  (it is in fact zero).  This illustrates how you can
  1687.          use the t value and Prob(t) to identify extraneous parameters.
  1688.  
  1689.  
  1690.  
  1691.  
  1692.                                          30
  1693.  
  1694.          Chapter 7. Example Analyses                                     31
  1695.  
  1696.  
  1697.          COOLING.NLR -- Fit an equation involving an exponential  function.
  1698.          If  a heated object is allowed to cool, the rate of cooling at any
  1699.          instant is proportional to the  difference  between  the  object's
  1700.          temperature  and  the ambient (room) temperature.  In other words,
  1701.          an object cools faster at first, while it is hot, and the rate  of
  1702.          cooling  slows  down  as  the temperature of the object approaches
  1703.          the ambient temperature.  The function that relates  the  object's
  1704.          temperature to time is:
  1705.  
  1706.               Temperature = Roomtemp+InitTemp*exp(-Coolrate*Time)
  1707.  
  1708.          Where  InitTemp is the number of degrees above room temperature at
  1709.          time 0, and Coolrate is a factor that depends on the mass  of  the
  1710.          object,  how  well  it is insulated, etc.  The exp function is the
  1711.          value of e (2.7182818...) raised  to  a  power.   The  COOLING.NLR
  1712.          example  determines the parameters InitTemp and Coolrate to fit an
  1713.          equation of this form to some data the author collected.
  1714.  
  1715.          BOIL.NLR -- The boiling point of water decreases as  the  pressure
  1716.          in  the  vessel  containing  the  water  decreases.   "Clapeyron's
  1717.          equation" shows that the boiling  point  is  related  to  pressure
  1718.          according to the following function:
  1719.  
  1720.               Temperature = b / log(Pressure/a) - 459.7
  1721.  
  1722.          Where  `Temperature'  is in degrees Fahrenheit (the 459.7 constant
  1723.          converts degrees Fahrenheit to  degrees  Rankine  --  relative  to
  1724.          absolute  zero),  `Pressure'  is  the  pressure  in  the vessel in
  1725.          pounds per square inch, and  `a'  and  `b'  are  parameters  whose
  1726.          values  are  to  be  determined.   The  data  for this example was
  1727.          collected by the author's son for a science project.
  1728.  
  1729.          MAGNET.NLR -- Fit a  function  involving  an  arc  tangent  and  a
  1730.          variable  to  the  third  power.   This  is an interesting physics
  1731.          problem.  If a magnet  is  placed  due  east  of  a  compass,  the
  1732.          deflection  of  the  compass needle from north is equal to the arc
  1733.          tangent of the  ratio  of  the  strength  of  the  magnet's  field
  1734.          relative  to  the  earth's  magnetic  field.   The strength of the
  1735.          magnet's field at the compass is  inversely  proportional  to  the
  1736.          cube  of  the  distance from the magnet to the compass.  Thus, the
  1737.          function relating these terms is
  1738.  
  1739.               Deflection = deg(atan(Strength / Distance ^ 3))
  1740.  
  1741.          The deg function converts an angle in radians to degrees.  In  the
  1742.          example,  Deflection and Distance are the variables, and the value
  1743.          of the Strength parameter is determined.
  1744.  
  1745.          DIODE.NLR -- The current through a diode increases sharply as  the
  1746.          voltage   across   the  diode  is  increased.   An  equation  that
  1747.          approximates the current flow as a function of the voltage is:
  1748.  
  1749.               I = exp(b*(V-c))
  1750.  
  1751.          Chapter 7. Example Analyses                                     32
  1752.  
  1753.  
  1754.          where `I' is the current, `V' is the voltage,  and  `b',  and  `c'
  1755.          are   parameters  that  are  to  be  estimated  by  the  nonlinear
  1756.          regression.
  1757.  
  1758.          AVLTIME.NLR -- An AVL tree is  a  balanced  binary  tree  used  to
  1759.          store  information in a computer's memory.  Because the entries in
  1760.          an AVL tree are kept in sorted order, and the tree is  kept  in  a
  1761.          balanced  form,  it  is  possible to rapidly find any entry in the
  1762.          tree.  The time required to create an AVL tree with N  entries  is
  1763.          approximately equal to:
  1764.  
  1765.               Time = a + b*N*log2(N)
  1766.  
  1767.          where  `a'  is  a  constant term equal to the overhead involved in
  1768.          starting and completing a tree  creation,  and  `b'  is  a  growth
  1769.          coefficient  that  depends  on  the  speed  of  the computer.  The
  1770.          log2(N) function is the log base 2 of N (the number  of  entries).
  1771.          The  AVLTIME.NLR  example  fits  an  equation  to  a data set that
  1772.          relates the time in seconds required to create an  AVL  tree  with
  1773.          the number of entries in the tree.
  1774.  
  1775.          PIECE.NLR   --   Piecewise   linear   function.   Fit  a  function
  1776.          consisting of two linear pieces that bend at X=5.  When X is  less
  1777.          than  5,  the slope of the function is B1.  When X is greater than
  1778.          or equal to 5, the slope  is  B2.   B0  is  the  Y  value  of  the
  1779.          function  at  X=5  (i.e.,  at  the  pivot  point).   The step(a,x)
  1780.          function returns the value 0 when x is less than `a';  it  returns
  1781.          1 when x is greater than or equal to `a'.
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.                                      Chapter 8
  1789.  
  1790.                        Root Finding and Function Minimization
  1791.  
  1792.  
  1793.  
  1794.  
  1795.          8.1 Specifying a Minimization Problem
  1796.  
  1797.          Although  it is designed for nonlinear regression analysis, Nonlin
  1798.          can also be  used  to  find  the  root  (zero  point)  or  minimum
  1799.          absolute  value  of a nonlinear expression.  To use Nonlin in this
  1800.          fashion follow these steps:
  1801.  
  1802.            . Do not use any VARIABLE statements.
  1803.  
  1804.            . Use PARAMETER statements to specify  the  names  and  optional
  1805.              starting  values  for  the  parameters  whose values are to be
  1806.              determined as the roots or minimum value of the expression.
  1807.  
  1808.            . Use the FUNCTION statement to  specify  the  expression  whose
  1809.              roots  or  minimum  value  is  to  be  found; do NOT specify a
  1810.              dependent  variable  and  equal  sign  --  specify  only   the
  1811.              expression that is to be minimized.
  1812.  
  1813.            . Do  not  include any data records after the DATA statement; it
  1814.              simply signals the end of the  command  file  and  causes  the
  1815.              analysis to begin.
  1816.  
  1817.          The  following  is an example command file to find the root of the
  1818.          expression SIN(X)-LOG(X):
  1819.  
  1820.               PARAMETER X
  1821.               FUNCTION SIN(X) - LOG(X)
  1822.               DATA
  1823.  
  1824.          Notice that the "variable" in the expression, X, is  not  declared
  1825.          to  be  a  variable  but  rather  a  parameter.   This  example is
  1826.          included in the file MINSL.NLR which you can run.
  1827.  
  1828.          For this type of analysis, Nonlin determines  the  values  of  the
  1829.          parameters  that  minimize  the  absolute value of the expression.
  1830.          If the expression has a zero value (i.e., a root), that  value  is
  1831.          found  since that is the smallest possible absolute value.  If the
  1832.          expression does not have  a  zero  point,  Nonlin  determines  the
  1833.          values  of the parameters that produce the smallest absolute value
  1834.          of the expression.  For example, the expression 2*x^2-3*x+10  does
  1835.          not  have  a  root  but reaches a minimum value of 8.875 when x is
  1836.          0.75.  The MINPAROB.NLR command file contains this example.
  1837.  
  1838.  
  1839.  
  1840.                                          33
  1841.  
  1842.          Chapter 8. Root Finding and Function Minimization               34
  1843.  
  1844.  
  1845.          There are a number of cautions that you should keep in  mind  when
  1846.          using Nonlin to find roots or minimum values:
  1847.  
  1848.            . Nonlin  will find only one root or minimum value per analysis.
  1849.              For example, the expression 9-x^2 has two roots:  -3  and  +3.
  1850.              Nonlin  will find one of the roots; which one it finds depends
  1851.              on the starting value specified for X.
  1852.  
  1853.            . Nonlin will find only real roots, not complex.
  1854.  
  1855.            . If the expression contains a local minimum,  Nonlin  may  find
  1856.              it  rather than the global minimum or root.  Of course, if you
  1857.              are looking for a local  minimum  in  a  certain  region  this
  1858.              could  be  considered  a feature.  For example, the expression
  1859.              0.5*x^3+5*(x-2)^2+15 has a local minimum at x=1.61 and a  root
  1860.              at  x=-13.38.   If  the  starting value of x is less than -8.3
  1861.              the root is found; if  the  starting  value  is  greater  than
  1862.              -8.3,  the local minimum is found.  If the expression contains
  1863.              only  a  single  variable,  use  the   Mathplot   program   to
  1864.              graphically  display  the  expression  and  determine  a  good
  1865.              starting value for the variable (see page  38  for  additional
  1866.              information  about  Mathplot).   The SWEEP command can also be
  1867.              used to try multiple starting  values  when  searching  for  a
  1868.              global minimum.
  1869.  
  1870.          8.2 Function Minimization Examples
  1871.  
  1872.          MINFALL.NLR  --  The  time  taken  for  an  object to slide down a
  1873.          frictionless guide from position (0,h) to another  position  (d,0)
  1874.          (i.e.,  falling through a distance `h' while moving horizontally a
  1875.          distance `d') depends on the path that  the  object  takes  as  it
  1876.          follows  the guide.  It turns out that the path that minimizes the
  1877.          descent time is not a  straight  line  from  (0,h)  to  (d,0)  but
  1878.          rather  a curve called a brachistochrone with a steeper slope near
  1879.          the beginning, that  gives  the  object  a  chance  to  accelerate
  1880.          quickly, and then a shallower slope further on.
  1881.  
  1882.          Finding  the  shape  of  this  curve  is  a classic problem in the
  1883.          branch of mathematics called  the  Calculus  of  Variations.   The
  1884.          MINFALL  example solves a simpler case of this problem: the object
  1885.          slides along a straight guide from  (0,1000)  to  an  intermediate
  1886.          position  (px,py),  and  then  along  another  straight guide from
  1887.          (px,py) to (1000,0).  What point, (px,py), minimizes  the  descent
  1888.          time?
  1889.  
  1890.          Note  concerning  the  answer:  The fall time for the object if it
  1891.          follows a straight guide  from  (0,1000)  to  (1000,0)  is  2.0203
  1892.          seconds;  the  fall  time  if it follows the two straight segments
  1893.          found by MINFALL is 1.8748; the fall time if it follows the  ideal
  1894.          curved  brachistochrone is 1.8590.  The speed of the object at the
  1895.          end of  the  fall  is  the  same  regardless  of  the  path  taken
  1896.          (conservation of energy).
  1897.  
  1898.          Chapter 8. Root Finding and Function Minimization               35
  1899.  
  1900.  
  1901.          MINFUEL.NLR  --  A  lunar  lander is hovering above the surface of
  1902.          the moon looking for a suitable landing site.  Available  fuel  is
  1903.          critical  and  the  desired  site  is  200  meters away.  How long
  1904.          should the horizontal thruster be fired  to  start  and  stop  the
  1905.          motion  over  the  ground?   The  vertical  thruster  must be used
  1906.          continuously to keep the lander from being pulled to the  surface.
  1907.          If  too  little horizontal thrust is used the spacecraft will move
  1908.          slowly and much fuel will be consumed  by  the  vertical  thruster
  1909.          counterbalancing  the  downward  gravitational pull while hovering
  1910.          over the surface.  On the other hand, if the  horizontal  thruster
  1911.          is  fired  for  a  long  time,  the  spacecraft  will move quickly
  1912.          (minimizing the hovering time) but excessive  fuel  will  be  used
  1913.          during  the horizontal acceleration and deceleration.  MINFUEL.NLR
  1914.          determines how long the thruster should be fired during the  start
  1915.          and  stop  accelerations  such  that  the  total  fuel consumption
  1916.          (start thrust + stop thrust + hover) is minimized.
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.                                      Chapter 9
  1924.  
  1925.                          Acknowledgement and Use of Nonlin
  1926.  
  1927.  
  1928.  
  1929.  
  1930.          9.1 Acknowledgement
  1931.  
  1932.          The nonlinear regression algorithm used by  Nonlin  was  published
  1933.          in  ACM  Transactions  on  Mathematical Software 7,3 (Sept.  1981)
  1934.          "Dennis, J.E.,  Gay,  D.M.,  and  Welsch,  R.E.   --  An  adaptive
  1935.          nonlinear least-squares algorithm."
  1936.  
  1937.          9.2 Use and Distribution of Nonlin
  1938.  
  1939.          There  are  two  versions  of  the  Nonlin  program: shareware and
  1940.          registered.  You are welcome  to  make  copies  of  the  shareware
  1941.          version  of  Nonlin  and  pass  them  on  to  friends or post this
  1942.          program on bulletin boards  or  distribute  it  via  disk  catalog
  1943.          services  provided  the  entire Nonlin distribution is included in
  1944.          its original, unmodified form.  A distribution fee may be  charged
  1945.          for  the  cost  of  the diskette, shipping and handling.  However,
  1946.          Nonlin may not be sold, or incorporated in  another  product  that
  1947.          is  sold,  without the permission of Phillip H.  Sherrod.  Vendors
  1948.          are encouraged to contact  the  author  to  get  the  most  recent
  1949.          version of Nonlin.
  1950.  
  1951.          As  a  shareware  product, you are granted a no-cost, trial period
  1952.          of 30 days during which you may  evaluate  Nonlin.   If  you  find
  1953.          Nonlin   to  be  useful,  educational,  and/or  entertaining,  and
  1954.          continue to use it  beyond  the  30  day  trial  period,  you  are
  1955.          required  to  compensate  the  author  by sending the registration
  1956.          form printed at the end of this  document  (and  in  REGISTER.DOC)
  1957.          with   the   appropriate   registration  fee  to  help  cover  the
  1958.          development and support of Nonlin.
  1959.  
  1960.          In return for registering, you  will  be  authorized  to  continue
  1961.          using  Nonlin  beyond  the  trial  period  and  you will receive a
  1962.          registered version of the program, a laser-printed, bound  manual,
  1963.          and  three  months  of support via telephone, mail, or CompuServe.
  1964.          Your registration fee will be refunded if you encounter a  serious
  1965.          bug that cannot be corrected.
  1966.  
  1967.          The  registered version of Nonlin omits the shareware notification
  1968.          screen at the start of the run and does not require you  to  press
  1969.          a  key  to proceed with the analysis.  The registered version also
  1970.          includes the ability to print plots on HP LaserJet printers.   The
  1971.          registered  version  of  Nonlin  is  NOT  shareware and may not be
  1972.          redistributed or used on more than one computer system.
  1973.  
  1974.  
  1975.                                          36
  1976.  
  1977.          Chapter 9. Acknowledgement and Use of Nonlin                    37
  1978.  
  1979.  
  1980.          The author frequently improves Nonlin and it is  likely  that  the
  1981.          version  you  have is not the most recent version.  Note, the cost
  1982.          of registering Nonlin is  insignificant  compared  with  what  you
  1983.          would  have  to  pay  to purchase a commercial statistical package
  1984.          with an equivalent regression capability.
  1985.  
  1986.          9.3 Association of Shareware Professionals
  1987.  
  1988.          This program is  produced  by  a  member  of  the  Association  of
  1989.          Shareware  Professionals  (ASP).   ASP wants to make sure that the
  1990.          shareware principle works for you.  If you are unable  to  resolve
  1991.          a  shareware-related  problem with an ASP member by contacting the
  1992.          member directly, ASP may be able to help.  The ASP  Ombudsman  can
  1993.          help  you  resolve  a  dispute  or problem with an ASP member, but
  1994.          does not provide technical support for members' products.   Please
  1995.          write  to the ASP Ombudsman at 545 Grover Road, Muskegon, MI 49442
  1996.          or send a CompuServe message via CompuServe Mail to ASP  Ombudsman
  1997.          7007,3536.
  1998.  
  1999.          You are welcome to contact the author:
  2000.  
  2001.                                  Phillip H. Sherrod
  2002.                                  4410 Gerald Place
  2003.                            Nashville, TN  37205-3806  USA
  2004.                               615-292-2881 (evenings)
  2005.                                CompuServe: 76166,2640
  2006.                         Internet: 76166.2640@compuserve.com
  2007.  
  2008.          9.4 Copyright Notice
  2009.  
  2010.          Both  the  Nonlin  program  and  documentation  are  copyright (c)
  2011.          1992-1993 by Phillip H.   Sherrod.   You  are  not  authorized  to
  2012.          modify the program.  "Nonlin" is a trademark.
  2013.  
  2014.          9.5 Disclaimer
  2015.  
  2016.          Nonlin  is  provided  "as is" without warranty of any kind, either
  2017.          expressed  or  implied.   This  program  may  contain  "bugs"  and
  2018.          inaccuracies,  and its results should not be assumed to be correct
  2019.          unless  they  are  verified  by  independent  means.   The  author
  2020.          assumes  no  responsibility  for the use of Nonlin and will not be
  2021.          responsible for any damage resulting from its use.
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.                                      Chapter 10
  2029.  
  2030.                                    Other Software
  2031.  
  2032.  
  2033.  
  2034.  
  2035.          10.1 Mathplot -- Mathematical Function Plotting Program
  2036.  
  2037.          If you like Nonlin, you should check out the Mathplot  program  by
  2038.          the same author.
  2039.  
  2040.          Mathplot  allows you to specify complicated mathematical functions
  2041.          using ordinary algebraic expressions and  immediately  plot  them.
  2042.          Four  types  of  functions  may  be specified: cartesian (Y=f(X));
  2043.          parametric cartesian (Y=f(T) and X=f(T)); polar
  2044.          (Radius=f(Angle));   and   parametric   polar   (Radius=f(T)   and
  2045.          Angle=f(T)).   Up to four functions may be plotted simultaneously.
  2046.          Scaling is automatic.   Options  are  available  to  control  axis
  2047.          display  and labeling as well as grid lines.  Hard copy output may
  2048.          be generated as well as screen  display.   Mathplot  is  an  ideal
  2049.          tool  for  engineers,  scientists,  math and science teachers, and
  2050.          anyone  else  who  needs   to   quickly   visualize   mathematical
  2051.          functions.
  2052.  
  2053.          Registered  users of Nonlin can order Mathplot for a special price
  2054.          of $18.  Or, for an even better deal, if you register  Nonlin  and
  2055.          order Mathplot at the same time, you can get both for $40.
  2056.  
  2057.          10.2 TSX-32 -- Multi-User Operating System
  2058.  
  2059.          If  you  have  a  need  for  a multi-user, multi-tasking operating
  2060.          system, you should look into TSX-32.  TSX-32 is  a  full-featured,
  2061.          high  performance, multi-user operating system for the 386 and 486
  2062.          that provides  both  32-bit  and  16-bit  program  support.   With
  2063.          facilities  such  as  multitasking  and multisessions, networking,
  2064.          virtual memory, X-Windows, background batch queues, data  caching,
  2065.          file  access  control,  real-time,  and  dial-in  support,  TSX-32
  2066.          provides a solid environment for a wide range of applications.
  2067.  
  2068.          A two user, shareware version of TSX-32 called  TSX-Lite  is  also
  2069.          available.
  2070.  
  2071.          TSX-32  is not a limited, 16-bit, multi-DOS add-on.  Rather, it is
  2072.          a complete 32-bit operating system which makes  full  use  of  the
  2073.          hardware's  potential, including protected mode execution, virtual
  2074.          memory, and demand paging.  TSX-32 sites range from small  systems
  2075.          with  2-3  terminals  to  large  installations  with  more than 64
  2076.          terminals on a single 386.
  2077.  
  2078.  
  2079.  
  2080.                                          38
  2081.  
  2082.          Chapter 10. Other Software                                      39
  2083.  
  2084.  
  2085.          In addition  to  supporting  most  popular  16-bit  DOS  programs,
  2086.          TSX-32  also provides a 32-bit "flat" address space with both Phar
  2087.          Lap and DPMI compatible modes of execution.
  2088.  
  2089.          Since the DOS file structure  is  standard  for  TSX-32,  you  can
  2090.          directly  read  and write DOS disks.  And, you can run DOS part of
  2091.          the time and TSX-32 the rest of the time on the same computer.
  2092.  
  2093.          TSX-32 allows each user to control up to  10  sessions.   Programs
  2094.          can  also  "fork"  subtasks  for multi-threaded applications.  The
  2095.          patented Adaptive Scheduling Algorithm provides consistently  good
  2096.          response time under varying conditions.
  2097.  
  2098.          The  TSX-32  network  option  provides  industry  standard  TCP/IP
  2099.          networking  through  Ethernet  and  serial  lines.   Programs  can
  2100.          access  files  on  remote  machines  as  easily  as  on  their own
  2101.          machine.  The SET HOST command allows a user  on  one  machine  to
  2102.          log  onto  another  computer in the network.  FTP, Telnet, and NFS
  2103.          are available for interoperability with other systems.
  2104.  
  2105.          TSX-32 is, quite simply, the  best  and  most  powerful  operating
  2106.          system  available for the 386 and 486.  For additional information
  2107.          contact:
  2108.  
  2109.                              S&H Computer Systems, Inc.
  2110.                                1027 17th Avenue South
  2111.                               Nashville, TN 37212 USA
  2112.                                 615-327-3670 (voice)
  2113.                                  615-321-5929 (fax)
  2114.                                 CompuServe: 71333,27
  2115.                          Internet: 71333.27@compuserve.com
  2116.  
  2117.           ===============================================================
  2118.                                 Software Order Form
  2119.           ===============================================================
  2120.  
  2121.          Name ______________________________________________________
  2122.  
  2123.          Address ___________________________________________________
  2124.  
  2125.          City _______________________  State _______ Zip ___________
  2126.  
  2127.          Telephone _________________________________________________
  2128.  
  2129.          CompuServe account (optional) _____________________________
  2130.  
  2131.          Nonlin version ____________________________________________
  2132.  
  2133.          Bulletin board where you found Nonlin _____________________
  2134.  
  2135.          Comments __________________________________________________
  2136.  
  2137.          Check the box below which indicates your order type:
  2138.  
  2139.              ___ I wish to register Nonlin ($25).
  2140.  
  2141.              ___ I wish to order Mathplot ($20).
  2142.  
  2143.              ___ I wish to register Nonlin and order Mathplot ($40).
  2144.  
  2145.          Add $5 to any amount shown above if the software is being  shipped
  2146.          out of the United States.
  2147.  
  2148.          In  return  for  registering,  you  will  receive  the  registered
  2149.          version of  the  program,  a  laser-printed,  bound  copy  of  the
  2150.          manual,  and  three  months  of  telephone  or CompuServe support.
  2151.          Your registration fee will be refunded if you find a  serious  bug
  2152.          that cannot be corrected.
  2153.  
  2154.          Distribution disk choice (check one):
  2155.  
  2156.                3.50" HD (1.4 MB)  ______
  2157.                5.25" HD (1.2 MB)  ______
  2158.                5.25" DD (360 KB)  ______
  2159.  
  2160.          Send this form with the amount indicated to the author:
  2161.  
  2162.                                  Phillip H. Sherrod
  2163.                                  4410 Gerald Place
  2164.                            Nashville, TN  37205-3806 USA
  2165.  
  2166.                               615-292-2881 (evenings)
  2167.                                CompuServe: 76166,2640
  2168.                         Internet: 76166.2640@compuserve.com
  2169.  
  2170.          Index                                                           41
  2171.  
  2172.  
  2173.          80x87 coprocessor, 29                 definition, 2
  2174.          ABS function, 7                       maximum, 22
  2175.          Absolute converge, 26              Diode current example, 31
  2176.          Acknowledgement, 36                Disclaimer, 37
  2177.          ACOS function, 7                   DPMI support, 39
  2178.          Adaptive algorithm, 25             Durbin-Watson statistic, 23
  2179.          AFCTOL value, 25                   E constant, 6
  2180.          Arc cosine function, 7             EI2 function, 7
  2181.          Arc sine function, 7               EIC1 function, 7
  2182.          Arc tangent function, 7            EIC2 function, 7
  2183.          Arighmetic operators, 6            EL1 function, 7
  2184.          ASIN function, 7                   Elliptic integral function,
  2185.          ASP, 37                                     7
  2186.          Assn. of Shareware Prof., 37       ERF function, 7
  2187.          Asymptotic function example,       Examples, 30
  2188.                   30                           asymptotic function, 30
  2189.          ATAN function, 7                      AVL tree, 32
  2190.          Author address, 37                    boiling water, 31
  2191.          Autoregression test, 18, 23           cooling, 31
  2192.          Average deviation, 22                 diode current, 31
  2193.          AVL tree example, 32                  function minimization, 34
  2194.          Bessel function, 8, 9                 linear regression, 30
  2195.          Beta function, 7                      lunar lander, 35
  2196.          BETAI function, 7                     magnet force, 31
  2197.          Brachistochrone, 34                   minimum time path, 34
  2198.          Build-in functions, 7                 multivariate, 30
  2199.          Built-in constants, 6                 negative exponential, 30,
  2200.          Calculus of variations, 34               31
  2201.          Chebyshev function, 9                 piecewise function, 32
  2202.          Clapeyron's equation, 31              quadratic equation, 30
  2203.          Command files, 9                      square wave, 30
  2204.          Commands, 11                          SWEEP command, 30
  2205.          Comments in command files, 9       EXP function, 8
  2206.          CONFIDENCE command, 12, 22         Exponentation operator, 6
  2207.          Confidence intervals, 12           FAC function, 8
  2208.          CONSTANT command, 6, 12            Factorial function, 8
  2209.          CONSTRAIN command, 13, 28          FUNCTION command, 14
  2210.          Continuation of lines, 9           Function minimization, 33
  2211.          Convergence criterion, 25          Functions, 7
  2212.             absolute, 26                    GAMMA function, 8
  2213.             relative, 26                    GAMMAI function, 8
  2214.          Convergence failures, 27           GAMMALN function, 8
  2215.          Cooling example, 31                Gauss-Newton algorithm, 25
  2216.          Copyright notice, 37               HAV function, 8
  2217.          COS function, 7                    Hessian, 25
  2218.          Cosecant function, 7               Hyperbolic cosine function,
  2219.          COSH function, 7                            7
  2220.          COT function, 7                    Hyperbolic sine function, 9
  2221.          COVARIANCE command, 13             Hyperbolic tangent function,
  2222.          CSC function, 7                             9
  2223.          DATA command, 19                   Incomplete beta function, 7
  2224.          DEG function, 7                    Installing Nonlin, 3
  2225.          Degrees to radians, 8              Inverse gamma function, 8
  2226.          Deviation                          ITERATIONS command, 14
  2227.             average, 22                     J0 function, 8
  2228.  
  2229.          Index                                                           42
  2230.  
  2231.  
  2232.          J1 function, 8                     PI constant, 6
  2233.          JN function, 8                     Piecewise function example,
  2234.          LaserJet                                    32
  2235.          LaserJet printer, 3, 36            PLOT command, 16
  2236.             resolution, 19                     options, 16
  2237.          Least squares regression, 2        Plots
  2238.          Levenberg-Marquardt, 25               data and function, 16
  2239.          Limits, 29                            normal probability, 18
  2240.          Linear regression, 1                  residual values, 17
  2241.             example, 30                        resolution, 19
  2242.          Listing file, 5                       width of, 19
  2243.          LOG function, 8                    Polynomial equation example,
  2244.          Log gamma function, 8                       30
  2245.          LOG10 function, 8                  POUTPUT command, 16
  2246.          LOG2 function, 8                      extra precision output,
  2247.          Lunar lander example, 35                 21
  2248.          Magnet example, 31                 $PREDICTED variable, 15
  2249.          Marquardt algorithm, 25            PRESOLUTION command, 19
  2250.          Mathplot, 38                       Prob(t) value, 22
  2251.          MAX function, 8                    Program limits, 29
  2252.          Maximum values, 21                 PULSE function, 8
  2253.          MIN function, 8                    Quadratic equation example,
  2254.          Minimiation algorithm, 25                   30
  2255.          Model/trust region, 25             RAD function, 8
  2256.          Multi-user operating system,       Radian to degree conversion,
  2257.                   38                                 7
  2258.          Multiple determination, 22         Ra^2 statistic, 23
  2259.          Multivariate regression, 30        Real-time, 38
  2260.          Mutually dependent, 28             REGISTER command, 15
  2261.          Natural log function, 8            REGISTER.DOC file, 3
  2262.          Negative exponential, 2, 30,       Registering Nonlin, 36
  2263.                   31                        Registration form, 40
  2264.          Networking, 39                     Relative convergence, 26
  2265.          NONLIN environment variable,       Residual
  2266.                   4                         Residual values
  2267.          NONLIN.DOC file, 3                    plotting, 17
  2268.          NONLIN.EXE file, 3                 $RESIDUAL variable, 15
  2269.          NONLIN.FON file, 3, 16                average, 22
  2270.          NONLIN.LJF file, 3                    definition, 2
  2271.          NORMAL function, 8                    maximum, 22
  2272.          Normal probablity plot, 18         RFCTOL value, 25
  2273.          NPD function, 8                    RPLOT command, 17
  2274.          NPLOT command, 18                     autocorrelation test, 24
  2275.             autocorrelation test, 24           options, 18
  2276.             options, 18                     R^2 statistic, 22
  2277.          Numeric constants, 6               S&H Computer Systems, Inc.,
  2278.          Numeric coprocessor, 29                     39
  2279.          $OBS variable, 15                  SEC function, 9
  2280.          Order form, 40                     Secant function, 9
  2281.          OUTPUT command, 15                 SEL function, 9
  2282.          PARAMETER command                  SET command, 4
  2283.             function minimization, 33       Sherrod, Phillip H., 37
  2284.          PARAMETERS command, 11             SIN function, 9
  2285.          PAREA function, 8                  Singular matrix problems, 28
  2286.          Performance issues, 28             SINH function, 9
  2287.  
  2288.          Index                                                           43
  2289.  
  2290.  
  2291.          SQRT function, 9
  2292.          Square wave example, 30
  2293.          Standard deviation, 21
  2294.          Standard error function, 7
  2295.          STEP function, 9
  2296.          Support of Nonlin, 36
  2297.          SWEEP command, 13
  2298.             convergence failure, 27
  2299.             example, 30
  2300.             function minimization, 34
  2301.             performance issues, 29
  2302.          Symbolic constants, 6
  2303.          T function, 9
  2304.          t statistic, 21, 22
  2305.          TAN function, 9
  2306.          TANH function, 9
  2307.          TCP/IP, 39
  2308.          Theory of operation, 25
  2309.          Time series data, 23
  2310.          TITLE command, 11
  2311.          TOLERANCE command, 14, 15
  2312.             converge criterion, 25
  2313.          TSX-32, 38
  2314.          TSX-Lite, 38
  2315.          Use and distribution, 36
  2316.          VARIABLES command, 11
  2317.          Variance-covariance matrix,
  2318.                   13
  2319.          Warranty, 37
  2320.          WIDTH command, 19
  2321.          X windows, 38
  2322.          Y0 function, 9
  2323.          Y1 function, 9
  2324.          YN function, 9
  2325.