SMC Procedure

SUBMITMODEL Statement

  • SUBMITMODEL dependent-variables <=independent-variables> < / options >;

The SUBMITMODEL statement indicates the start of your user-defined program statements between the SUBMITMODEL and ENDSUBMIT statements or specifies a file that contains your user-defined program statements in the FILE= option. When you specify the SUBMITMODEL statement, the AUXMODEL, INITSTATE, MODEL, PARAMETERS, PRIOR, STATE, STATEVAR, and VAR statements are ignored.

PROC SMC loads the predefined functions or subroutines from the current CMPLIB session and combines them with the functions or subroutines defined in the SUBMITMODEL statement. For more information about the combination of the CMPLIB session and SUBMITMODEL statement, see the section Method 2.

The SUBMITMODEL defines the user-defined functions or subroutines by using either the FILE= option or the user-defined program statements that appear between the SUBMITMODEL and ENDSUBMIT statements. If you specify the FILE= option, you cannot add lines of code for the user-defined program in the SUBMITMODEL statement. If you omit the FILE= option in the SUBMITMODEL statement, then PROC SMC executes all lines of code that are specified between the SUBMITMODEL and ENDSUBMIT statements. For more information, see the section ENDSUBMIT Statement.

To define a state space model, you define FCMP functions and subroutines in the user-defined program. For more information, see the "FCMP Procedure" chapter in the Base SAS Procedures Guide. Each function or subroutine must be named using the format less-thanmodel-namegreater-than_less-thankeywordgreater-than, where model-name must be identical to the name specified in the NAME= option and keyword identifies the function or subroutine. The total length of the name should not exceed 32 characters. Each function or subroutine must have a specific signature, which consists of the number of arguments, sequence and types of arguments, and return value type. The summary of all the recognized function and subroutine names and their expected behavior is presented in Table 7. Moreover, the type, definition, and size of each argument in the functions and subroutines are summarized in Table 8. Consider the following points when you define a distribution model:

  • When you define a function or subroutine, the name, type, and order of those arguments must follow the corresponding signature syntax and semantics. For more information about the signature syntax and semantics, see the section Signature Syntax and Semantics of User-Defined Functions and Subroutines.

  • When the SMC procedure invokes any function or subroutine, it provides the necessary input values according to the specified signature, and it expects the function or subroutine to prepare the output and return it according to the specification of the return values in the signature.

  • You can use most of the SAS programming statements and SAS functions that you can use in a DATA step to define the FCMP functions and subroutines. However, there are a few differences in the capabilities of the DATA step and the FCMP procedure. To learn more, see the documentation of the FCMP procedure in the Base SAS Procedures Guide.

  • The dimensions of the state variable and parameter array must match the values specified in the NSTATE= and NPARM= options in the SUBMITMODEL statement. The dimensions of the dependent and independent variable array must match the number of variables specified in the dependent-variables and independent-variables in the SUBMITMODEL statement. The dimensions of the lagged variables must match the XLAG=, YLAG=, and ZLAG= option values. For more information, see Table 8.

  • Not all the functions and subroutines are required. Whether you need to define a particular function or subroutine depends on the SMC algorithms and other statements (see the section Signature Syntax and Semantics of User-Defined Functions and Subroutines).

  • The results of the subroutine should be returned in the parameter arguments of the subroutine.

You can specify the following options in the SUBMITMODEL statement after a forward slash (/):

FILE=SAS-file-ref | 'File-path'

specifies a file that contains your user-defined program. If you specify this option, you cannot specify the ENDSUBMIT statement.

You can specify the file either by including a SAS-file-ref that is defined in a prior SAS FILENAME statement or by including a quoted string (a 'File-path') that identifies the host-specific file path.

The following rules apply when you specify the FILE= option:

  • The text file that you specify must contain only the program statements that you want to submit and none of the PROC SMC statements. You cannot include an ENDSUBMIT statement in the file.

  • The text file that you specify must not contain any SAS macro statements or macro variable references. The file content is submitted as specified.

NAME=symbol-name

specifies the name of the model of interest. The model should be defined using the user-defined program (see the section Method 2).

NPARM=number

specifies the number of parameters. The number should be a nonnegative integer.

NSTATE<(numeric-list)>=number

specifies the number of state variables. The number should be a nonnegative integer. The optional numeric-list in parentheses specifies the number of levels of all category variables. Each value in the numeric-list must be a positive integer, and values can be separated by commas or spaces. The number of values in the numeric-list must be less than or equal to the number of state variables. For each categorical state variable, its level values start from 0. For example, if a categorical state variable has three levels, its value is 0, 1, or 2.

In the underlying SMC algorithms of the SMC procedure, the category state variables are positioned before the noncategorical state variables in the state variable vector. For example, suppose that there are d Subscript x state variables and d Subscript x is defined by the NSTATE= option. If there are d Subscript c (0 less-than-or-equal-to d Subscript c Baseline less-than-or-equal-to d Subscript x) values in the numeric-list, then the first d Subscript c state variables are category variables and the remaining d Subscript x Baseline minus d Subscript c state variables are noncategorical variables.

XLAG=(xlag-options)

specifies the lag orders of the state variables in the distribution functions. For the XLAG= option in the SUBMITMODEL statement, the value of INIT= suboption must be greater than or equal to normal m normal a normal x left-parenthesis r 1 comma r 2 minus 1 comma r 3 minus 1 right-parenthesis, where r 1, r 2, r 3 are specified by the MEAS=, STATE=, and AUX= suboptions, respectively.

You can specify one or more of the following xlag-options:

AUX=number
AUXILIARY=number

specifies the maximum lag order of the state variables in the auxiliary distribution function (name_EVALNEXTMEAS). If the APF algorithm is not specified in one or more of the EVALUATE, FILTER, FORECAST, LEARN, or LEARN statements, the AUX= suboption is ignored. By default, AUX=1.

INIT=number
INITIALIZATION=number

specifies the maximum lag order of the state variables in the initialization distribution functions (name_SAMPINIT or name_EVALINIT) and proposal initialization distribution functions (name_SAMPINITP or name_EVALINITP). By default, INIT=0.

MEAS=number
MEASUREMENT=number
MODEL=number

specifies the maximum lag order of the state variables in the measurement distribution functions (name_EVALMEAS or name_SAMPMEAS). By default, MEAS=0.

STATE=number
TRAN=number
TRANSITION=number

specifies the maximum lag order of the state variables in the transition distribution functions (name_SAMPTRAN or name_EVALTRAN) and proposal transition distribution functions (name_SAMPTRANP or name_EVALTRANP). By default, STATE=1.

YLAG=(ylag-options)

specifies the lag orders of the dependent in the distribution functions. You can specify one or more of the following ylag-options:

AUX=number
AUXILIARY=number

specifies the maximum lag order of the dependent variables in the auxiliary distribution function (name_EVALNEXTMEAS). If the APF algorithm is not specified in one or more of the EVALUATE, FILTER, FORECAST, LEARN, or LEARN statements, the AUX= suboption is ignored. By default, AUX=0.

INIT=number
INITIALIZATION=number

specifies the maximum lag order of the dependent variables in the initialization distribution functions (name_SAMPINIT or name_EVALINIT) and proposal initialization distribution functions (name_SAMPINITP or name_EVALINITP). By default, INIT=0.

MEAS=number
MEASUREMENT=number
MODEL=number

specifies the maximum lag order of the dependent variables in the measurement distribution functions (name_EVALMEAS or name_SAMPMEAS). By default, MEAS=0.

STATE=number
TRAN=number
TRANSITION=number

specifies the maximum lag order of the dependent variables in the transition distribution functions (name_SAMPTRAN or name_EVALTRAN) and proposal transition distribution functions (name_SAMPTRANP or name_EVALTRANP). By default, STATE=0.

ZLAG=(zlag-options)

specifies the lag orders of the independent in the distribution functions. You can specify one or more of the following zlag-options:

AUX=number
AUXILIARY=number

specifies the maximum lag order of the independent variables in the auxiliary distribution function (name_EVALNEXTMEAS). If the APF algorithm is not specified in one or more of the EVALUATE, FILTER, FORECAST, LEARN, or LEARN statements, the AUX= suboption is ignored. By default, AUX=0.

INIT=number
INITIALIZATION=number

specifies the maximum lag order of the independent variables in the initialization distribution functions (name_SAMPINIT or name_EVALINIT) and proposal initialization distribution functions (name_SAMPINITP or name_EVALINITP). By default, INIT=0.

MEAS=number
MEASUREMENT=number
MODEL=number

specifies the maximum lag order of the independent variables in the measurement distribution functions (name_EVALMEAS or name_SAMPMEAS). By default, MEAS=0.

STATE=number
TRAN=number
TRANSITION=number

specifies the maximum lag order of the independent variables in the transition distribution functions (name_SAMPTRAN or name_EVALTRAN) and proposal transition distribution functions (name_SAMPTRANP or name_EVALTRANP). By default, STATE=0.

Table 7 shows functions and subroutines that define a state space model, and the subsections after the table provide more details.

Table 7: Functions and Subroutines That Define a State Space Model

Name Type Expected to Return
name_EVALINIT Function LOGPDF of the initialization distribution
name_EVALINITP Function LOGPDF of the proposal initialization distribution
name_EVALMEAS Function LOGPDF of the measurement distribution
name_EVALNEXTMEAS Function LOGPDF of the auxiliary distribution
name_EVALPRIO Function LOGPDF of the prior distribution
name_EVALTRAN Function LOGPDF of the transition distribution
name_EVALTRANP Function LOGPDF of the proposal transition distribution
name_LOWERBOUNDS Subroutine Lower bounds of the parameters
name_SAMPINIT Subroutine A sample from the initialization distribution
name_SAMPINITP Subroutine A sample from the proposal initialization distribution
name_SAMPMEAS Subroutine A sample from the measurement distribution
name_SAMPPRIO Subroutine Initial values for the parameters
name_SAMPTRAN Subroutine A sample from the transition distribution
name_SAMPTRANP Subroutine A sample from the proposal transition distribution
name_UPPERBOUNDS Subroutine Upper bounds of the parameters


Signature Syntax and Semantics of User-Defined Functions and Subroutines

Each function or subroutine has a fixed sequence and type of arguments. The name of each argument is also fixed. All the arguments of the functions and subroutines are listed in Table 8, where n is specified by the NPARM= option, d Subscript x is defined by the NSTATE= option, d Subscript y is the number of dependent variables, d Subscript z is defined by the number of independent variables, r is specified by the maximum value in the XLAG=(xlag-options) option, p is specified by the maximum value in the YLAG=(ylag-options) option, and s is specified by the maximum value in the ZLAG=(zlag-options) option. Moreover, _time refers to the actual time index of the observations (see the section Time Index).

For an array argument array-argument[*] that is one of theta[*], x[*], y[*], and z[*], the ith (i greater-than-or-equal-to 1) element, array-argument[i], refers to the ith element of the corresponding variable or parameter vector. For a lagged variable array argument lag-array-argument[*] that is one of xlag[*], ylag[*], and zlag[*], lag-array-argumentleft-bracket left-parenthesis j minus 1 right-parenthesis asterisk d plus i right-bracket (i comma j greater-than-or-equal-to 1) refers to the jth order of lag for the ith element of the corresponding variable whose dimension is denoted by d. For more information about the array or lagged array arguments for the parameter, state variables, dependent variables, and independent variables, see the sections Method 2: Parameters, Method 2: State Variables, Method 2: Dependent Variables, Method 2: Independent Variables, and Method 2: Lagged Variables.

Table 8: List of Arguments in Functions and Subroutines

Name Type Definition Size
theta[*] Input/Output array Parameters n
x[*] Input/Output array Current state variables d Subscript x
xlag[*] Input/Output array Lagged state variables d Subscript x*r
y[*] Input/Output array Current dependent variables d Subscript y
ylag[*] Input array Lagged dependent variables d Subscript y*p
z[*] Input array Current independent variables d Subscript z
zlag[*] Input array Lagged independent variables d Subscript z*s
_time Input scalar Actual time index 1


The details of the argument, signature syntax, and semantics of each function or subroutine are listed as follows:

name_EVALINIT

defines a function that returns the log of the probability density function (LOGPDF) of the initialization distribution, mu Subscript bold-italic theta Baseline left-parenthesis bold upper X Subscript 1 minus tau colon 1 Baseline vertical-bar bold upper Y Subscript 1 minus p colon 0 Baseline comma bold upper Z Subscript 1 minus s colon 1 Baseline right-parenthesis.

  • Type: FUNCTION

  • Requirement: Required only when the APF or SIR algorithm is specified and the name_SAMPINITP function is specified

  • Number of arguments: 7

  • Sequence and type of arguments:

    x[*]

    Input numeric array of the current state variables at the initial time step

    xlag[*]

    Input numeric array of the lagged state variables before the initial time step

    ylag[*]

    Input numeric array of the lagged dependent variables before the initial time step

    z[*]

    Input numeric array of the current independent variables at the initial time step

    zlag[*]

    Input numeric array of the lagged independent variables before the initial time step

    theta[*]

    Input numeric array of the parameters

    _time

    Input numeric value of the current actual time index

Here is a sample structure of this function for a model named 'TOY':

function TOY_EVALINIT(x[*],xlag[*],ylag[*],z[*],zlag[*],theta[*],_time);
   /*Code to compute LOGPDF based on initialization distribution*/
   LOGPDF = <computed logpdf>;
   return (LOGPDF);
endsub;
name_EVALINITP

defines a function that returns the LOGPDF of the proposal initialization distribution, q Subscript bold-italic theta Superscript 1 Baseline left-parenthesis bold upper X Subscript 1 minus tau colon 1 Baseline vertical-bar bold upper Y Subscript 1 minus p colon 1 Baseline comma bold upper Z Subscript 1 minus s colon 1 Baseline right-parenthesis.

  • Type: FUNCTION

  • Requirement: Required only when the APF or SIR algorithm is specified and the name_SAMPINITP function is specified

  • Number of arguments: 8

  • Sequence and type of arguments:

    x[*]

    Input numeric array of the current state variables at the initial time step

    xlag[*]

    Input numeric array of the lagged state variables before the initial time step

    y[*]

    Input numeric array of the current dependent variables at the initial time step

    ylag[*]

    Input numeric array of the lagged dependent variables before the initial time step

    z[*]

    Input numeric array of the current independent variables at the initial time step

    zlag[*]

    Input numeric array of the lagged independent variables before the initial time step

    theta[*]

    Input numeric array of the parameters

    _time

    Input numeric value of the current actual time index

Here is a sample structure of this function for a model named 'TOY':

function TOY_EVALINITP(x[*],xlag[*],y[*],ylag[*],z[*],zlag[*],theta[*],_time);
   /*Code to compute LOGPDF based on proposal initialization distribution*/
   LOGPDF = <computed logpdf>;
   return (LOGPDF);
endsub;
name_EVALMEAS

defines a function that returns the LOGPDF of the measurement distribution, g Subscript bold-italic theta Baseline left-parenthesis bold upper Y Subscript t Baseline vertical-bar bold upper X Subscript t minus r colon t Baseline comma bold upper Y Subscript t minus p colon t minus 1 Baseline comma bold upper Z Subscript t minus s colon t Baseline right-parenthesis.

  • Type: FUNCTION

  • Requirement: Always required

  • Number of arguments: 8

  • Sequence and type of arguments:

    x[*]

    Input numeric array of the current state variables

    xlag[*]

    Input numeric array of the lagged state variables

    y[*]

    Input numeric array of the current dependent variables

    ylag[*]

    Input numeric array of the lagged dependent variables

    z[*]

    Input numeric array of the current independent variables

    zlag[*]

    Input numeric array of the lagged independent variables

    theta[*]

    Input numeric array of the parameters

    _time

    Input numeric value of the current actual time index

Here is a sample structure of this function for a model named 'TOY':

function TOY_EVALMEAS(x[*],xlag[*],y[*],ylag[*],z[*],zlag[*],theta[*],_time);
   /*Code to compute LOGPDF based on measurement distribution*/
   LOGPDF = <computed logpdf>;
   return (LOGPDF);
endsub;
name_EVALNEXTMEAS

defines a function that returns the LOGPDF of the auxiliary distribution, ModifyingAbove p With caret Subscript theta Baseline left-parenthesis bold upper Y Subscript t Baseline vertical-bar bold upper X Subscript t minus r colon t minus 1 Baseline comma bold upper Y Subscript t minus p colon t minus 1 Baseline comma bold upper Z Subscript t minus s colon t Baseline right-parenthesis.

  • Type: FUNCTION

  • Required: Required only when the APF algorithm is specified in one or more of the EVALUATE, FILTER, FORECAST, LEARN, and SMOOTH statements.

  • Number of arguments: 7

  • Sequence and type of arguments:

    xlag[*]

    Input numeric array of the lagged state variables

    y[*]

    Input numeric array of the current dependent variables

    ylag[*]

    Input numeric array of the lagged dependent variables

    z[*]

    Input numeric array of the current independent variables

    zlag[*]

    Input numeric array of the lagged independent variables

    theta[*]

    Input numeric array of the parameters

    _time

    Input numeric value of the current actual time index

Here is a sample structure of this function for a model named 'TOY':

function TOY_EVALNEXTMEAS(xlag[*],y[*],ylag[*],z[*],zlag[*],theta[*],_time);
   /*Code to compute LOGPDF based on the approximated density function*/
   LOGPDF = <computed logpdf>;
   return (LOGPDF);
endsub;
name_EVALPRIO

defines a function that defines the LOGPDF of the prior distribution, p left-parenthesis bold-italic theta right-parenthesis.

  • Type: FUNCTION

  • Required: Required only when the PMCMC method is specified in the LEARN statement

  • Number of arguments: 1

  • Sequence and type of arguments:

    theta[*]

    Input numeric array of the parameters

Here is a sample structure of this function for a model named 'TOY':

function TOY_EVALPRIO(theta[*]);
   /*Code to compute LOGPDF based on the prior distribution*/
   LOGPDF = <computed logpdf>;
   return (LOGPDF);
endsub;
name_EVALTRAN

defines a function that returns LOGPDF of the transition distribution, f Subscript bold-italic theta Baseline left-parenthesis bold upper X Subscript t Baseline vertical-bar bold upper X Subscript t minus r colon t minus 1 Baseline comma bold upper Y Subscript t minus p colon t minus 1 Baseline comma bold upper Z Subscript t minus s colon t Baseline right-parenthesis.

  • Type: FUNCTION

  • Requirement: Required only when the APF or SIR algorithm is specified and the name_SAMPTRANP subroutine is specified

  • Number of arguments: 7

  • Sequence and type of arguments:

    x[*]

    Input numeric array of the current state variables

    xlag[*]

    Input numeric array of the lagged state variables

    ylag[*]

    Input numeric array of the lagged dependent variables

    z[*]

    Input numeric array of the current independent variables

    zlag[*]

    Input numeric array of the lagged independent variables

    theta[*]

    Input numeric array of the parameters

    _time

    Input numeric value of the current actual time index

Here is a sample structure of this function for a model named 'TOY':

function TOY_EVALTRAN(x[*],xlag[*],ylag[*],z[*],zlag[*],theta[*],_time);
   /*Code to compute LOGPDF based on the transition distribution*/
   LOGPDF = <computed logpdf>;
   return (LOGPDF);
endsub;
name_EVALTRANP

defines a function that returns the LOGPDF of the proposal transition distribution, q Subscript bold-italic theta Baseline left-parenthesis bold upper X Subscript t Baseline vertical-bar bold upper X Subscript t minus r colon t minus 1 Baseline comma bold upper Y Subscript t minus p colon t Baseline comma bold upper Z Subscript t minus s colon t Baseline right-parenthesis.

  • Type: FUNCTION

  • Requirement: Required only when the APF or SIR algorithm is specified and the name_SAMPTRANP subroutine is specified

  • Number of arguments: 8

  • Sequence and type of arguments:

    x[*]

    Input numeric array of the current state variables

    xlag[*]

    Input numeric array of the lagged state variables

    y[*]

    Input numeric array of the current dependent variables

    ylag[*]

    Input numeric array of the lagged dependent variables

    z[*]

    Input numeric array of the current independent variables

    zlag[*]

    Input numeric array of the lagged independent variables

    theta[*]

    Input numeric array of the parameters

    _time

    Input numeric value of the current actual time index

Here is a sample structure of this function for a model named 'TOY':

function TOY_EVALTRANP(x[*],xlag[*],y[*],ylag[*],z[*],zlag[*],theta[*],_time);
   /* Code to compute LOGCDF based on the proposal transition distribution*/
   LOGPDF = <computed logpdf>;
   return (LOGPDF);
endsub;
name_LOWERBOUNDS

defines a subroutine that returns lower bounds for the parameters. To indicate the output numeric array, the line "outargs theta;" must appear after the line "subroutine name_LOWERBOUNDS(theta[*]);".

  • Type: SUBROUTINE

  • Requirement: Not always required

  • Number of arguments: 1

  • Sequence and type of arguments:

    theta[*]

    Output numeric array of the parameters. theta[i] assigns the lower bound for the ith parameter.

If this subroutine is not defined, then the SMC procedure assumes a lower bound of negative normal infinity for each parameter. If a lower bound of l Subscript i is returned for a parameter p Subscript i, then PROC SMC assumes that l Subscript i Baseline less-than p Subscript i (strict inequality). If a missing value or no value is returned for one parameter, then PROC SMC assumes that there is no lower bound for that parameter (this is equivalent to a lower bound of negative normal infinity).

Here is a sample structure of this subroutine for a model named 'TOY' that has three parameters:

subroutine TOY_LOWERBOUNDS(theta[*]);
   outargs theta;
   theta[1] = <lower bound for the first parameter>;
   /*the second parameter is missing */
   theta[3] = <lower bound for the third parameter>;
endsub;
name_SAMPINIT

defines a subroutine that returns the initial state variables drawn from the initialization distribution, mu Subscript bold-italic theta Baseline left-parenthesis bold upper X Subscript 1 minus tau colon 1 Baseline vertical-bar bold upper Y Subscript 1 minus p colon 0 Baseline comma bold upper Z Subscript 1 minus s colon 1 Baseline right-parenthesis. To indicate the output numeric arrays, the line "outargs x, xlag;" must appear after the line "subroutine name_SAMPINIT(x[*],xlag[*],ylag[*],z[*],zlag[*],theta[*],_time);".

  • Type: SUBROUTINE

  • Requirement: Required only when either of the following conditions is satisfied:

    • The BF algorithm is specified.

    • The APF or SIR algorithm is specified and the name_SAMPINITP subroutine is not specified.

  • Number of arguments: 7

  • Sequence and type of arguments:

    x[*]

    Output numeric array of the current state variables at the initial time step. x[i] assigns the initial value of the ith state variable.

    xlag[*]

    Output numeric array of the lagged state variables before the initial time step xlagleft-bracket left-parenthesis j minus 1 right-parenthesis asterisk d Subscript x Baseline plus i right-bracket (i comma j greater-than-or-equal-to 1) assigns the initial value of the jth order of lag for the ith state variable.

    ylag[*]

    Input numeric array of the lagged dependent variables before the initial time step

    z[*]

    Input numeric array of the current independent variables at the initial time step

    zlag[*]

    Input numeric array of the lagged independent variables before the initial time step

    theta[*]

    Input numeric array of the parameters

    _time

    Input numeric value of the current actual time index

Here is a sample structure of this subroutine for a model named 'TOY' that has three state variables:

subroutine TOY_SAMPINIT(x[*],xlag[*],ylag[*],z[*],zlag[*],theta[*],_time);
   outargs x, xlag;
   /*Code to generate x and xlag based on the sampling initial distribution*/
   x[1] = <generated first state variable>;
   x[2] = <generated second state variable>;
   x[3] = <generated third state variable>;
endsub;
name_SAMPINITP

defines a subroutine that returns the initial state variables drawn from the proposal initialization distribution, q Subscript bold-italic theta Superscript 1 Baseline left-parenthesis bold upper X Subscript 1 minus tau colon 1 Baseline vertical-bar bold upper Y Subscript 1 minus p colon 1 Baseline comma bold upper Z Subscript 1 minus s colon 1 Baseline right-parenthesis. To indicate the output numeric arrays, the line "outargs x, xlag;" must appear after the line "subroutine name_SAMPINITP(x[*],xlag[*],y[*],ylag[*],z[*],zlag[*],theta[*],_time);".

  • Type: SUBROUTINE

  • Required: Required only when the APF or SIR algorithm is specified and the proposal initialization distribution, q Subscript bold-italic theta Superscript 1 Baseline left-parenthesis bold upper X Subscript 1 minus tau colon 1 Baseline vertical-bar bold upper Y Subscript 1 minus p colon 1 Baseline comma bold upper Z Subscript 1 minus s colon 1 Baseline right-parenthesis, is different from the initialization distribution, mu Subscript bold-italic theta Baseline left-parenthesis bold upper X Subscript 1 minus tau colon 1 Baseline vertical-bar bold upper Y Subscript 1 minus p colon 0 Baseline comma bold upper Z Subscript 1 minus s colon 1 Baseline right-parenthesis

  • Number of arguments: 8

  • Sequence and type of arguments:

    x[*]

    Output numeric array of the current state variables at the initial time step. x[i] assigns the initial value of the ith state variable.

    xlag[*]

    Output numeric array of the lagged state variables before the initial time step. xlagleft-bracket left-parenthesis j minus 1 right-parenthesis asterisk d Subscript x Baseline plus i right-bracket (i comma j greater-than-or-equal-to 1) assigns the initial value of the jth order of lag for the ith state variable.

    y[*]

    Input numeric array of the lagged dependent variables at the initial time step

    ylag[*]

    Input numeric array of the lagged dependent variables before the initial time step

    z[*]

    Input numeric array of the current independent variables at the initial time step

    zlag[*]

    Input numeric array of the lagged independent variables before the initial time step

    theta[*]

    Input numeric array of the parameters

    _time

    Input numeric value of the current actual time index

Here is a sample structure of this subroutine for a model named 'TOY' that has three state variables:

subroutine TOY_SAMPINITP(x[*],xlag[*],y[*],ylag[*],z[*],zlag[*],theta[*],_time);
   outargs x, xlag;
   /*Code to generate x and xlag based on the sampling initial distribution*/
   x[1] = <generated first state variable>;
   x[2] = <generated second state variable>;
   x[3] = <generated third state variable>;
endsub;
name_SAMPMEAS

defines a subroutine that returns the current dependent variables drawn from the measurement distribution, g Subscript bold-italic theta Baseline left-parenthesis bold upper Y Subscript t Baseline vertical-bar bold upper X Subscript t minus r colon t Baseline comma bold upper Y Subscript t minus p colon t minus 1 Baseline comma bold upper Z Subscript t minus s colon t Baseline right-parenthesis. To indicate the output numeric array, the line "outargs y;" must appear after the line "subroutine name_SAMPMEAS(x[*],xlag[*],y[*],ylag[*],z[*],zlag[*],theta[*],_time);".

  • Type: SUBROUTINE

  • Requirement: Required when the FORECAST statement is specified

  • Number of arguments: 8

  • Sequence and type of arguments:

    x[*]

    Input numeric array of the current state variables

    xlag[*]

    Input numeric array of the lagged state variables

    y[*]

    Output numeric array of the current dependent variables. y[i] assigns the value of the ith current dependent variable.

    ylag[*]

    Input numeric array of the lagged dependent variables

    z[*]

    Input numeric array of the current independent variables

    zlag[*]

    Input numeric array of the lagged independent variables

    theta[*]

    Input numeric array of the parameters

    _time

    Input numeric value of the current actual time index

Here is a sample structure of this subroutine for a model named 'TOY' that has one dependent variable:

subroutine TOY_SAMPMEAS(x[*],xlag[*],y[*],ylag[*],z[*],zlag[*],theta[*],_time);
   outargs y;
   /*Code to generate x based on the sampling observation distribution*/
   y[1] = <the first generated dependent variable>;
endsub;
name_SAMPPRIO

defines a subroutine that returns the initial values of the parameters. To indicate the output numeric array, the line "outargs theta;" must appear after the line "subroutine name_SAMPPRIO(theta[*]);".

  • Type: Subroutine

  • Requirement: Always required

  • Number of arguments: 1

  • Sequence and type of arguments:

    theta[*]

    Output numeric array of the parameters. theta[i] assigns the initial value of the ith parameter.

Here is a sample structure of this subroutine for a model named 'TOY' that has three parameters:

subroutine TOY_SAMPPRIO(theta[*]);
   outargs theta;
   /*Code to initialize parameters*/
   theta[1] = <initial value of the first parameter>;
   theta[2] = <initial value of the second parameter>;
   theta[3] = <initial value of the third parameter>;
endsub;
name_SAMPTRAN

defines a subroutine that returns the current state variables drawn from the transition distribution, f Subscript bold-italic theta Baseline left-parenthesis bold upper X Subscript t Baseline vertical-bar bold upper X Subscript t minus r colon t minus 1 Baseline comma bold upper Y Subscript t minus p colon t minus 1 Baseline comma bold upper Z Subscript t minus s colon t Baseline right-parenthesis. To indicate the output numeric array, the line "outargs x;" must appear after the line "subroutine name_SAMPTRAN(x[*],xlag[*],ylag[*],z[*],zlag[*],theta[*],_time);".

  • Type: SUBROUTINE

  • Requirement: Required only when one of the following conditions is satisfied:

    • The BF algorithm is specified.

    • The APF or SIR algorithm is specified and the name_SAMPTRANP subroutine is not specified.

    • The FORECAST statement is specified.

  • Number of arguments: 7

  • Sequence and type of arguments:

    x[*]

    Output numeric array of the current state variables. x[i] assigns the value of the ith current state variable.

    xlag[*]

    Input numeric array of the lagged state variables

    ylag[*]

    Input numeric array of the lagged dependent variables

    z[*]

    Input numeric array of the current independent variables

    zlag[*]

    Input numeric array of the lagged independent variables

    theta[*]

    Input numeric array of the parameters

    _time

    Input numeric value of the current actual time index

Here is a sample structure of this subroutine for a model named 'TOY' that has three state variables:

subroutine TOY_SAMPTRAN(x[*],xlag[*],ylag[*],z[*],zlag[*],theta[*],_time);
   outargs x;
   /*Code to generate x based on the sampling transition distribution*/
   x[1] = <the first generated state variable>;
   x[2] = <the second generated state variable>;
   x[3] = <the third generated state variable>;
endsub;
name_SAMPTRANP

defines a subroutine that returns the current state variables drawn from the proposal transition distribution, q Subscript bold-italic theta Baseline left-parenthesis bold upper X Subscript t Baseline vertical-bar bold upper X Subscript t minus r colon t minus 1 Baseline comma bold upper Y Subscript t minus p colon t Baseline comma bold upper Z Subscript t minus s colon t Baseline right-parenthesis. To indicate the output numeric array, the line "outargs x;" must appear after the line "subroutine name_SAMPTRANP(x[*],xlag[*],y[*],ylag[*],z[*],zlag[*],theta[*],_time);".

  • Type: SUBROUTINE

  • Requirement: Required only when the APF or SIR algorithm is specified and the proposal transition distribution, q Subscript bold-italic theta Baseline left-parenthesis bold upper X Subscript t Baseline vertical-bar bold upper X Subscript t minus r colon t minus 1 Baseline comma bold upper Y Subscript t minus p colon t Baseline comma bold upper Z Subscript t minus s colon t Baseline right-parenthesis, is different from the transition distribution, f Subscript bold-italic theta Baseline left-parenthesis bold upper X Subscript t Baseline vertical-bar bold upper X Subscript t minus r colon t minus 1 Baseline comma bold upper Y Subscript t minus p colon t minus 1 Baseline comma bold upper Z Subscript t minus s colon t Baseline right-parenthesis.

  • Number of arguments: 9

  • Sequence and type of arguments:

    x[*]

    Output numeric array of the current state variables. x[i] assigns the value of the ith current state variable.

    xlag[*]

    Input numeric array of the lagged state variables

    y[*]

    Input numeric array of the current dependent variables

    ylag[*]

    Input numeric array of the lagged dependent variables

    z[*]

    Input numeric array of the current independent variables

    zlag[*]

    Input numeric array of the lagged independent variables

    theta[*]

    Input numeric array of the parameters

    _time

    Input numeric value of the current actual time index

Here is a sample structure of this subroutine for a model named 'TOY' that has three state variables:

subroutine TOY_SAMPTRANP(x[*],xlag[*],y[*],ylag[*],z[*],zlag[*],theta[*],_time);
   outargs x;
   /*Code to generate x based on the sampling transition distribution*/
   x[1] = <the first generated state variable>;
   x[2] = <the second generated state variable>;
   x[3] = <the third generated state variable>;
endsub;
name_UPPERBOUNDS

defines a subroutine that returns upper bounds for the parameters. To indicate the output numeric array, the line "outargs theta;" must appear after the line "subroutine name_UPPERBOUNDS(theta[*]);".

  • Type: Subroutine

  • Requirement: Not always required

  • Number of arguments: 1

  • Sequence and type of arguments:

    theta[*]

    Output numeric array of the parameters. theta[i] assigns the upper bound for the ith parameter.

Here is a sample structure of this subroutine for a model named 'TOY' that has three parameters:

subroutine TOY_UPPERBOUNDS(theta[*]);
   outargs theta;
   theta[1] = <upper bound for the first parameter>;
   theta[2] = <upper bound for the second parameter>;
   theta[3] = <upper bound for the third parameter>;
endsub;

If this subroutine is not defined, then the SMC procedure assumes that there is no upper bound for any of the parameters. If an upper bound of u Subscript i is returned for a parameter p Subscript i, then PROC SMC assumes that p Subscript i Baseline less-than u Subscript i (strict inequality). If a missing value or no value is returned for one parameter, then PROC SMC assumes that there is no upper bound for that parameter (this is equivalent to an upper bound of normal infinity).

Last updated: July 09, 2026