Syntax


The following statements are available in PROC SIM2D.

  • PROC SIM2D options ;

    • COORDINATES coordinate- variables ;

    • GRID grid-options ;

    • SIMULATE simulate-options ;

    • MEAN mean-options ;

The SIMULATE and MEAN statements are hierarchical; you can specify any number of SIMULATE statements, but you must specify at least one. If you specify a MEAN statement, it refers to the preceding SIMULATE statement. If you do not specify a MEAN statement, a zero mean model is simulated.

You must specify a single COORDINATES statement to identify the x and y coordinate variables in the input data set when you perform a conditional simulation. You must also specify a single GRID statement to specify the grid information.

The following table outlines the options available in PROC SIM2D classified by function.

Table 65.1: Options Available in the SIM2D Procedure

Task

Statement

Option

Data Set Options

specify input data set

PROC SIM2D

DATA=

specify grid data set

GRID

GDATA=

specify quadratic form data set

MEAN

QDATA=

write simulated values

PROC SIM2D

OUTSIM=

Declaring the Role of Variables

specify the conditioning variable

SIMULATE

VAR=

specify the x and y coordinate variables in the DATA= data set

COORDINATES

XC= YC=

specify the x and y coordinate variables in the GDATA=dataset

GRID

XC= YC=

specify the constant coefficient variable in the QDATA=dataset

MEAN

CONST=

specify the linear x coefficient variable in the QDATA= data set

MEAN

CX=

specify the linear y coefficient variable in the QDATA= data set

MEAN

CY=

specify the quadratic x coefficient variable in the QDATA=dataset

MEAN

CXX=

specify the quadratic y coefficient variable in the QDATA=dataset

MEAN

CYY=

specify the quadratic xy coefficient variable in the QDATA= data set

MEAN

CXY=

Controlling the Simulation

specify the number of realizations

SIMULATE

NUMREAL=

specify the seed value for the random generator

SIMULATE

SEED=

Controlling the Mean Quadratic Surface

specify the CONST term

MEAN

CONST=

specify the linear x term

MEAN

CX=

specify the linear y term

MEAN

CY=

specify the quadratic x term

MEAN

CXX=

specify the quadratic y term

MEAN

CYY=

specify the quadratic cross term

MEAN

CXY=

Controlling the Semivariogram Model

specify a nugget effect

SIMULATE

NUGGET=

specify a functional form

SIMULATE

FORM=

specify nested functional forms

SIMULATE

FORM=( f 1 , , f k )

specify a range parameter

SIMULATE

RANGE=

specify nested range parameters

SIMULATE

RANGE=( r 1 , , r k )

specify a scale parameter

SIMULATE

SCALE=

specify nested scale parameters

SIMULATE

SCALE=( s 1 , , s k )

specify an angle for an anisotropic model

SIMULATE

ANGLE=

specify nested angles

SIMULATE

ANGLE=( a 1 , , a k )

specify a minor-major axis ratio for an anisotropic model

SIMULATE

RATIO=

specify nested minor-major axis ratios

SIMULATE

RATIO=( ra 1 , , ra k )

PROC SIM2D Statement

PROC SIM2D options ;

  • You can specify the following options with the PROC SIM2D statement.

DATA= SAS-data-set

  • specifies a SAS data set containing the x and y coordinate variables and the SIMULATE VAR= variables. This data set is required if any of the SIMULATE statements are conditional, that is, if you specify the VAR= option. If none of the SIMULATE statements are conditional then you do not need the DATA= option, and this option is ignored if you specify it.

NARROW

  • restricts the variables included in the OUTSIM= data set. When you specify the NARROW option, only four variables are included. This option is useful when a large number of simulations are produced. Including only four variables reduces the memory required for the OUTSIM= data set. For details on the variables that are excluded with the NARROW option, see the section 'Output Data Set' on page 4110.

OUTSIM= SAS-data-set

  • specifies a SAS data set to store the simulation values, iteration number, simulate statement label, variable name , and grid location. For details, see the section 'Output Data Set' on page 4110.

COORDINATES Statement

  • COORDINATES coordinate-variables ;

The following two options give the name of the variables in the DATA= data set containing the values of the x and y coordinates of the conditioning data.

Only one COORDINATES statement is allowed, and it is applied to all SIMULATE statements that have a VAR= specification. In other words, it is assumed that all the VAR= variables in all SIMULATE statements have the same x and y coordinates.

You can abbreviate the COORDINATES statement as COORD.

XCOORD= (variable-name)

XC= (variable-name)

  • gives the name of the variable containing the x coordinate of the data in the DATA= data set.

YCOORD= (variable-name)

YC= (variable-name)

  • gives the name of the variable containing the y coordinate of the data locations in the DATA= data set.

GRID Statement

  • GRID grid-options ;

The following options can be used to specify the grid of spatial locations at which to perform the simulations. A single GRID statement is required and is applied to all SIMULATE statements.

There are two basic methods for specifying the grid. You can specify the x and y coordinates explicitly, or they can be read from a SAS data set. The options for the explicit specification of grid locations are as follows .

X= number

X= x 1 , ..., x m

X= x 1 to x m

X= x 1 to x m by x

  • specifies the x coordinate of the grid locations.

Y= number

Y= y 1 , ..., y m

Y= y 1 to y m

Y= y 1 to y m by y

  • specifies the y coordinate of the grid locations.

  • For example, the following two GRID statements are equivalent:

  grid x=1,2,3,4,5  y=0,2,4,6,8,10;   grid x=1 to 5 y=0 to 10 by 2;  
  • To specify grid locations from a SAS data set, you must provide the name of the data set and the variables containing the values of the x and y coordinates.

GRIDDATA= SAS-data-set

GDATA= SAS-data-set

  • specifies a SAS data set containing the x and y grid coordinates.

XCOORD= (variable-name)

XC= (variable-name)

  • gives the name of the variable containing the x coordinate of the grid locations in the GRIDDATA= data set.

YCOORD= (variable-name)

YC= (variable-name)

  • gives the name of the variable containing the y coordinate of the grid locations in the GRIDDATA= data set.

SIMULATE Statement

  • SIMULATE simulate-options ;

The SIMULATE statement specifies details on the simulation and the covariance model used in the simulation. You can specify the following options with a SIMULATE statement, which can be abbreviated by SIM.

NUMREAL= number

NUMR= number

NR= number

  • specifies the number of realizations to produce for the spatial process specified by the covariance model. Note that the number of observations in the OUTSIM= data set contributed by a given SIMULATE statement is the product of the NUMREAL= value with the number of grid points. This can cause the OUTSIM= data set to become large even for moderate values of the NUMREAL= option.

VAR= (variable-name)

  • specifies the single numeric variable used as the conditioning variable in the simulation. In other words, the simulation is conditional on the values of the VAR= variable found in the DATA= data set. If you omit the VAR= option, the simulation is unconditional . Since multiple SIMULATE statements are allowed, you can perform both unconditional and conditional simulations with a single PROC SIM2D statement.

Covariance Model Specification

There are two ways to specify a semivariogram or covariance model. In the first method, you can specify the required parameters SCALE, RANGE, and FORM, and possibly the optional parameters NUGGET, ANGLE, and RATIO, explicitly in the SIMULATE statement.

In the second method, you can specify an MDATA= data set. This data set contains variables corresponding to the required SCALE, RANGE, and FORM parameters, and, optionally , variables for the NUGGET, ANGLE, and RATIO parameters.

The two methods are exclusive; either you specify all parameters explicitly, or they are all are read from the MDATA= data set.

ANGLE= angle

ANGLE= (angle 1 , , angle k )

  • specifies the angle of the major axis for anisotropic models, measured in degrees clockwise from the N-S axis. In the case of a nested semivariogram model, you can specify an angle for each nesting. The default is ANGLE=0.

FORM= form_spec

FORM= (form_spec 1 , form_spec 2 , , form_spec k )

  • specifies the functional form or forms of the semivariogram model, where form_spec can take only the values SPHERICAL, EXPONENTIAL, and GAUSSIAN. The two ways of specifying the FORM= parameter allows specification of both nested and nonnested models. The following abbreviations are permitted. For the spherical model, you can specify the form_spec as FORM=SPHERICAL, FORM=SPH, or FORM=S. For the exponential model, you can specify the form_spec as FORM=EXPONENTIAL, FORM=EXP, or FORM=E. For the Gaussian model, you can specify the form_spec as FORM=GAUSSIAN, FORM=GAUSS, or FORM=G.

MDATA= SAS-data-set

  • specifies the input data set that contains parameter values for the covariance or semivariogram model. The MDATA= data set must contain variables named SCALE, RANGE, and FORM, and it can optionally contain the variables NUGGET, ANGLE, and RATIO.

  • The FORM variables must be character, and they can assume the same values allowed in the explicit FORM= syntax described previously. The RANGE and SCALE variables must be numeric. The optional variables ANGLE, RATIO, and NUGGET must also be numeric if present.

  • The number of observations present in the MDATA= data set corresponds to the level of nesting of the covariance or semivariogram model. For example, to specify a nonnested model using a spherical covariance, an MDATA= data set might look like the following.

      data md1;   input scale range form $;   datalines;   25 10 sph   run;  
  • The PROC SIM2D statement to use the MDATA= specification is of the form

      proc sim2d data=...;   sim var=.... mdata=md1;   run;  
  • This is equivalent to the following explicit specification of the covariance model parameters:

      proc sim2d data=...;   sim var=.... scale=25 range=10 form=sph;   run;  
  • The following MDATA= data set is an example of an anisotropic nested model:

      data md2;   input scale range form $ nugget angle ratio;   datalines;   20 8 S  5 35 .7   12 3 G  5 0  .8   4  1 G  5 45 .5   ;   proc sim2d data=...;   sim var=.... mdata=md2;   run;  
  • This is equivalent to the following explicit specification of the covariance model parameters:

      proc sim2d data=...;   sim var=.... scale=(20,12,4) range=(8,3,1) form=(S,G,G)   angle=(35,0,45) ratio=(.7,.8,.5) nugget=5;   run;  
  • This example is somewhat artificial in that it is usually hard to detect different anisotropy directions and ratios for different nestings using an experimental semivariogram. Note that the NUGGET value is the same for all nestings. This is always the case; the nugget effect is a single additive term for all models. For further details, refer to the section 'The Nugget Effect' on page 2051 in Chapter 37, 'The KRIGE2D Procedure.'

  • The SIMULATE statement can be given a label. This is useful for identification in the OUTSIM= data set when multiple SIMULATE statements are specified.

  • For example,

      proc sim2d data=...;   gauss1: sim var=.... form=gauss;   mean ....;   gauss2: sim var=.... form gauss;   mean ....;   exp1: sim var=.... form=exp;   mean ....;   exp2: sim var=.... form=exp;   mean ....;   run;  
  • In the OUTSIM= data set, the values 'GAUSS1', 'GAUSS2', 'EXP1', and 'EXP2' for the LABEL variable help to identify the realizations corresponding to the four SIMULATE statements. If you do not provide a label for a SIMULATE statement, a default label of SIM n is given, where n is the number of unlabeled SIMULATE statements seen so far.

NUGGET= number

  • specifies the nugget effect for the model. This effect is due to a discontinuity in the semivariogram as determined by plotting the sample semivariogram (refer to the section 'The Nugget Effect' on page 2051 in the chapter on the KRIGE2D procedure for details). For models without any nugget effect, the NUGGET= option is left out. The default is NUGGET=0.

RANGE= range

RANGE= (range 1 , , range k )

  • specifies the range parameter in the semivariogram models. In the case of a nested semivariogram model, you must specify a range for each nesting.

  • The range parameter is the divisor in the exponent in all supported models. It has the units of distance or distance squared for these models, and it is related to the correlation scale for the underlying spatial process. Refer to the section 'Theoretical Semivariogram Models' beginning on page 2045 in the chapter on the KRIGE2D procedure for details on how the RANGE= values are determined.

RATIO= ratio

RATIO= (ratio 1 , , ratio k )

  • specifies the ratio of the length of the minor axis to the length of the major axis for anisotropic models. The value of the RATIO= option must be between 0 and 1. In the case of a nested semivariogram model, you can specify a ratio for each nesting. The default is RATIO=1.

SCALE= scale

SCALE= (scale 1 , , scale k )

  • specifies the scale parameter in semivariogram models. In the case of a nested semivariogram model, you must specify a scale for each nesting.

  • The scale parameter is the multiplicative factor in all supported models; it has the same units as the variance of the VAR= variable. Refer to the section 'Theoretical Semivariogram Models' beginning on page 2045 in the chapter on the KRIGE2D procedure for details on how the SCALE= values are determined.

SEED= seed value

  • specifies the seed to use for the random number generator. If you omit the SEED= value, the system clock is used.

SINGULAR= number

  • gives the singularity criteria for solving the set of linear equations involved in the computation of the mean and covariance of the conditional distribution associated with a given SIMULATE statement. The larger the value of the SINGULAR= option, the easier it is for the covariance matrix system to be declared singular. The default is SINGULAR=1E-8. For more details on the use of the SINGULAR= option, see the section 'Computational and Theoretical Details of Spatial Simulation' beginning on page 4106.

MEAN Statement

  • MEAN spec 1 , ... , spec 6 ;

  • MEAN QDATA= SAS-data-set CONST=var 1 CX=var 2 CY=var 3

  • CXX=var 4 CYY=var 5 CXY=var 6 ;

  • MEAN QDATA= SAS-data-set ;

A mean function µ ( s ) that is a quadratic in the coordinates can be written

click to expand

The MEAN statement is used to specify the quadratic surface to use as the mean function for the simulated SRF. There are three ways to specify the MEAN statement. The MEAN statement allows the specification of the coefficients ² , , ² 5 either explicitly or through a QDATA= data set.

An example of an explicit specification is

  mean 1.4 + 2.5*x + 3.6*y + .47*x*x + .58*y*y + .69*x*y;  

In this example, all terms have a nonzero coefficient. Any term with a zero coefficient is simply left out of the specification. For example,

  mean 1.4;  

is a valid quadratic form with all terms having zero coefficients except the constant term.

An equivalent way of specifying the mean function is through the QDATA= data set. For example, the following MEAN statement

  mean 1.4 + 2.5*x + 3.6*y + .47*x*x + .58*y*y + .69*x*y;  

can be alternatively specified by the following DATA step and MEAN statement:

  data q1;   input c1 c2 c3 c4 c5 c6;   datalines;   1.4 2.5 3.6 .47 .58 .69   run;   proc sim2d data=....;   simulate ...;   mean qdata=q1 const=c1 cx=c2 cy=c3 cxx=c4   cyy=c5 cxy=c6;   run;  

The QDATA= data set specifies the data set containing the coefficients. The parameters CONST=, CX=, CY=, CXX=, CYY=, and CYX= specify the variables in the QDATA= data set that correspond to the constant, linear x, linear y, and so on. For any coefficient not specified in this list, the QDATA= data set is checked for the presence of variables with default names of CONST, CX, CY, CXX, CYY, and CXY. If these variables are present, their values are taken as the corresponding coefficients. Hence, you can rewrite the previous example as

  data q1;   input const cx cy cxx cyy cxy;   datalines;   1.4 2.5 3.6 .47 .58 .69   ;   proc sim2d data=....;   simulate ...;   mean qdata=q1;   run;  

If a given coefficient does not appear in the list or in the data set with the default name, a value of zero is assumed.




SAS.STAT 9.1 Users Guide (Vol. 6)
SAS.STAT 9.1 Users Guide (Vol. 6)
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 127

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net