SAS.STAT 9.1 Users Guide (Vol. 4)

A vertical bar () denotes a choice between two specifications. The other program statements are valid SAS expressions that can appear in the DATA step. PROC NLIN enables you to create new variables within the procedure and use them in the nonlinear analysis. The NLIN procedure automatically creates several variables that are also available for use in the analysis. See the section Special Variables beginning on page 3020 for more information. The PROC NLIN, PARMS , and MODEL statements are required.

The statements used in PROC NLIN, in addition to the PROC statement, are as follows :

BOUNDS

constrains the parameter estimates within specified bounds

BY

specifies variables to define subgroups for the analysis

DER

specifies the first or second partial derivatives

ID

specifies additional variables to add to the output data set

MODEL

defines the relationship between the dependent and indep endent variables

OUTPUT

creates an output data set containing statistics for each observation

PARMS

identifies parameters to be estimated and the starting values for each parameter

other program statements

includes assignment statements, ARRAY statements, DO loops , and program control statements

PROC NLIN Statement

The PROC NLIN statement invokes the procedure. The following table lists the options available with the PROC NLIN statement. Explanations follow in alphabetical order.

Task

Options

Specify data sets

DATA=

OUTEST=

SAVE

Grid search

BEST=

Choose an iteration method

METHOD=

Control step size

MAXSUBIT=

NOHALVE

RHO=

SMETHOD=

TAU=

Specify details of iteration

G4

UNCORRECTEDDF

SIGSQ=

Minimization Tuning

CONVERGE=

CONVERGEOBJ=

CONVERGEPARM=

SINGULAR=

MAXITER=

Modify Amount of Output

HOUGAARD

NOITPRINT

NOPRINT

List Model Structure

LIST

LISTALL

LISTCODE

LISTDEP

LISTDER

XREF

Trace Model Execution

FLOW

PRINT

TRACE

BEST= n

CONVERGE= c

CONVERGEOBJ= c

CONVERGEPARM= c

DATA= SAS-data-set

FLOW

G4

HOUGAARD

LIST

LISTALL

LISTCODE

LISTDEP

LISTDER

MAXITER= i

MAXSUBIT= i

METHOD=GAUSS MARQUARDT NEWTON GRADIENT

NOITPRINT

NOHALVE

NOPRINT

OUTEST= SAS-data-set

PRINT

RHO= value

SAVE

SIGSQ= value

SINGULAR= s

SMETHOD=HALVE GOLDEN CUBIC

TAU= value

TRACE

XREF

UNCORRECTEDDF

BOUNDS Statement

The BOUNDS statement restrains the parameter estimates within specified bounds. In each BOUNDS statement, you can specify a series of bounds separated by commas. The series of bounds is applied simultaneously . Each bound contains a list of parameters, an inequality comparison operator, and a value. In a single-bounded expression, these three elements follow one another in the order described. The following are examples of valid single-bounded expressions:

bounds a1 a10<=20; bounds c>30; boundsa b c > 0;

Multiple-bounded expressions are also permitted. For example,

bounds 0<=B<=10; bounds 15<x1<=30; bounds r <= s <= p < q;

If you need to restrict an expression involving several parameters (for example, A + B < 1), you can reparameterize the model so that the expression becomes a parameter.

For SAS versions 7.01 and later, lagrange multipliers are reported for all bounds that are enforced (active) when the estimation terminates. In the estimates table the Lagrange multiplier estimates are identified with names Bound1 , Bound2 ... . An active bound is treated as if a restriction was applied to the set of parameters so one parameter degree of freedom is deducted. The option UNCORRECTEDDF specifies that no degrees of freedom are lost when a bound is active.

BY Statement

You can specify a BY statement with PROC NLIN to obtain separate analyses on observations in groups defined by the BY variables. When a BY statement appears, the procedure expects the input data set to be sorted in order of the BY variables.

If your input data set is not sorted in ascending order, use one of the following alternatives:

For more information on the BY statement, refer to the discussion in SAS Language Reference: Concepts . For more information on the DATASETS procedure, refer to the discussion in the SAS Procedures Guide .

CONTROL Statement

The CONTROL statement declares control variables and specifies their values. A control variable is like a retained variable (see the section RETAIN Statement on page 3016) except that it is retained across iterations and the derivative of the model with respect to a control variable is always zero.

DER Statements

The DER statement specifies first or second partial derivatives. By default, analytical derivatives are automatically computed. However, you can specify the derivatives yourself by using the DER.parm syntax. Use the first form shown to specify first partial derivatives, and use the second form to specify second partial derivatives. Note that the DER.parm syntax is retained for backward compatibility. The automatic analytical derivatives are, in general, a better choice. For additional information on automatic analytical derivatives, see the section Automatic Derivatives beginning on page 3017.

For most of the computational methods, you need only specify the first partial derivative for each parameter to be estimated. For the NEWTON method, specify both the first and the second derivatives. If any needed derivatives are not specified, they are automatically computed.

If you use the _LOSS_ variable, you can specify the derivative of _LOSS_ with respect to the parameters using the DER. syntax.For more information, see the Special Variable Used to Determine Convergence Criteria section on page 3021.

The expression can be an algebraic representation of the partial derivative of the expression in the MODEL statement with respect to the parameter or parameters that appear in the left-hand side of the DER statement. Numerical derivatives can also be used. The expression in the DER statement must conform to the rules for a valid SAS expression, and it can include any quantities that the MODEL statement expression contains.

ID Statement

The ID statement specifies additional variables to place in the output data set created by the OUTPUT statement. Any variable on the left-hand side of any assignment statement is eligible. Also, the special variables created by the procedure can be specified. Variables in the input data set do not need to be specified in the ID statement since they are automatically included in the output data set.

MODEL Statement

The MODEL statement defines the prediction equation by declaring the dependent variable and defining an expression that evaluates predicted values. The expression can be any valid SAS expression yielding a numeric result. The expression can include parameter names, variables in the data set, and variables created by program statements in the NLIN procedure. Any operators or functions that can be used in a DATA step can also be used in the MODEL statement.

A statement such as

model y= expression ;

is translated into the form

model.y= expression ;

using the compound variable name model.y to hold the predicted value. You can use this assignment as an alternative to the MODEL statement. Either a MODEL statement or an assignment to a compound variable such as model.y must appear.

OUTPUT Statement

The OUTPUT statement specifies an output data set to contain statistics calculated for each observation. For each statistic, specify the keyword, an equal sign, and a variable name for the statistic in the output data set. All of the names appearing in the OUTPUT statement must be valid SAS names, and none of the new variable names can match a variable already existing in the data set to which PROC NLIN is applied.

If an observation includes a missing value for one of the independent variables, both the predicted value and the residual value are missing for that observation. If the iterations fail to converge, all the values of all the variables named in the OUTPUT statement are missing values.

You can specify the following options in the OUTPUT statement. For a description of computational formulas, see Chapter 2, Introduction to Regression Procedures.

OUT= SAS-data-set

H= name

L95M= name

L95= name

PARMS= names

PREDICTED= name

P= name

RESIDUAL= name

R= name

SSE= name

ESS= name

STDI= name

STDP= name

STDR= name

STUDENT= name

U95M= name

U95= name

WEIGHT= name

PARAMETERS Statement

A PARAMETERS (or PARMS) statement must come before the RUN statement. Several parameter names and values can appear. The parameter names must all be valid SAS names and must not duplicate the names of any variables in the data set to which the NLIN procedure is applied. Any parameters specified but not used in the MODEL statement are dropped from the estimation.

In each parameter=values specification, the parameter name identifies a parameter to be estimated, both in subsequent procedure statements and in the output. Values specify the possible starting values of the parameter.

Usually, only one value is specified for each parameter. If you specify several values for each parameter, PROC NLIN evaluates the model at each point on the grid. The value specifications can take any of several forms:

m

a single value

m 1, m 2, ... , mn

several values

m TO n

a sequence where m equals the starting value, n equals the ending value, and the increment equals 1

m TO n BY i

a sequence where m equals the starting value, n equals the ending value, and the increment is i

m 1, m 2 TO m 3

mixed values and sequences

This PARMS statement specifies five parameters and sets their possible starting values as shown:

parms b0=0 b1=4 to 8 b2=0 to .6 by .2 b3=1, 10, 100 b4=0, .5, 1 to 4;

Possible starting values

B0

B1

B2

B3

B4

4

0.0

1

0.0

 

5

0.2

10

0.5

 

6

0.4

100

1.0

 

7

0.6

 

2.0

 

8

   

3.0

       

4.0

Residual sums of squares are calculated for each of the 1 — 5 — 4 — 3 — 6 = 360 combinations of possible starting values. (This can take a long time.) See the Special Variables section beginning on page 3020 for information on programming parameter starting values.

RETAIN Statement

The RETAIN statement declares retained variables and specifies their values. A retained variable is like a control variable (see the section CONTROL Statement on page 3011) except that it is retained only within iterations. An iteration involves a single pass through the data set.

Other Program Statements with PROC NLIN

PROC NLIN supports many statements that are similar to SAS programming statements used in a DATA step. However, there are some differences in capabilities; for additional information, see the section Incompatibilities with 6.11 and Earlier Versions of PROC NLIN beginning on page 3031.

Several SAS program statements can be used after the PROC NLIN statement. These statements can appear anywhere in the PROC NLIN statement, but new variables must be created before they appear in other statements. For example, the following statements are valid since they create the variable temp before they use it in the MODEL statement:

proc nlin; parms b0=0 to 2 by 0.5 b1=0.01 to 0.09 by 0.01; temp=exp(-b1*x); model y=b0*(1-temp);

The following statements result in missing values for y because the variable temp is undefined before it is used:

proc nlin; parms b0=0 to 2 by 0.5 b1=0.01 to 0.09 by 0.01; model y=b0*(1-temp); temp=exp(-b1*x);

PROC NLIN can process assignment statements, explicitly or implicitly subscripted ARRAY statements, explicitly or implicitly subscripted array references, IF statements, SAS functions, and program control statements. You can use program statements to create new SAS variables for the duration of the procedure. These variables are not permanently included in the data set to which PROC NLIN is applied. Program statements can include variables in the DATA= data set, parameter names, variables created by preceding program statements within PROC NLIN, and special variables used by PROC NLIN. All of the following SAS program statements can be used in PROC NLIN:

These statements can use the special variables created by PROC NLIN. Consult the section Special Variables beginning on page 3020 for more information on special variables.

Категории