SMC Procedure

LEARN Statement

  • LEARN <options>;

The LEARN statement estimates the parameters. You can specify the following options:

ALGORITHM=algorithm
ALG=algorithm

specifies the particle filter algorithm. You can specify one of the following algorithms:

APF<(ADP)>

specifies the auxiliary particle filter (APF) algorithm. The ADP suboption specifies the fully adapted auxiliary particle filter algorithm.

BF

specifies the bootstrap filter (BF) algorithm.

SIR<(TH | THRESH | THRESHOLD=number)>

specifies the sequential importance resampling (SIR) algorithm. The optional TH= option specifies the threshold (a value between 0 and 1) of the resampling step in the SIR algorithm. The resampling step occurs when the effective sample size is less than the product of the threshold and the number of particles. By default, TH=0.8.

By default, ALGORITHM=SIR.

NPARTICLE=number

specifies the number of particles to use in the parameter estimation. If you omit this option, the parameter estimation uses the value of the NPARTICLE= option in the PROC SMC statement.

METHOD=PMCMC <(pmcmc-options)>

specifies the particle Markov chain Monte Carlo method and customizes its behavior with the pmcmc-options. By default, METHOD=PMCMC.

You can specify the following pmcmc-options in parentheses:

DIAGNOSTICS <(diag-options)>=ALL | NONE | keyword-list | (keyword-list)
DIAG <(diag-options)>=ALL | NONE | keyword-list | (keyword-list)

specifies which diagnostics to produce. If the value of the NCHAIN= option is greater than 1, then instead of the diagnostic tables being produced for each Markov chain, by default the results of the diagnostics for all the chains are appropriately comb ined and summarized. For more information, see the section Using Multiple Chains in Chapter 2, Introduction to Bayesian Analysis Procedures. You can specify one or both of the following diag-options:

BYCHAIN

produces diagnostic tables for each Markov chain. If NCHAIN=1, then the BYCHAIN option does nothing.

SETTINGS

produces a table of all MCMC diagnostic settings.

If you specify both the BYCHAIN and SETTINGS options, separate them by using a space or a comma. To produce all diagnostics, specify DIAGNOSTICS=ALL. To produce no diagnostics, specify DIAGNOSTICS=NONE. To produce some but not all diagnostics, or to change certain settings of these diagnostics, specify one or more of the following keywords. If you specify multiple keywords, separate them by using spaces.

AUTOCORR <(LAGS=numeric-list)>
AC <(LAGS=numeric-list)>

computes the autocorrelations at lags that you specify in the numeric-list. For more information, see the section Autocorrelations in Chapter 2, Introduction to Bayesian Analysis Procedures. Elements in the numeric-list must be positive integers, and values can be separated either by spaces or by commas. Repeated values are removed. If you omit the LAGS= option, autocorrelations of lags 1, 5, 10, and 50 are computed.

GEWEKE <(geweke-options)>
GEW <(geweke-options)>

computes the Geweke spectral density diagnostics. For more information, see the section Geweke Diagnostics in Chapter 2, Introduction to Bayesian Analysis Procedures. You can specify the following geweke-options:

FRAC1=value
F1=value

specifies the fraction f 1 for the first window. By default, FRAC1=0.1.

FRAC2=value
F2=value

specifies the fraction f 2 for the second window. By default, FRAC2=0.5.

HEIDELBERGER <(heidel-options)>
HEIDEL <(heidel-options)>
HB <(heidel-options)>

computes the Heidelberger-Welch diagnostic for each variable. For more information, see the section Heidelberger-Welch Diagnostics in Chapter 2, Introduction to Bayesian Analysis Procedures. You can specify one or more of the following heidel-options:

EPSILON=value
EPS=value

specifies a positive number epsilon such that if the halfwidth is less than epsilon times the sample mean of the retained iterates, the halfwidth test is passed. By default, EPSILON=0.1.

HALFWIDTH_ALPHA=value
HALPHA=value

specifies the alpha level left-parenthesis 0 less-than alpha less-than 1 right-parenthesis for the halfwidth test. By default, HALFWIDTH_ALPHA=0.05.

STATIONARY_ALPHA=value
SALPHA=value

specifies the alpha level left-parenthesis 0 less-than alpha less-than 1 right-parenthesis for the stationarity test. By default, STATIONARY_ALPHA=0.05.

RAFTERY <(raftery-options)>
RL <(raftery-options)>

computes the Raftery-Lewis diagnostics. For more information, see the section Raftery-Lewis Diagnostics in Chapter 2, Introduction to Bayesian Analysis Procedures. You can specify one or more of the following raftery-options:

ACCURACY=value
ACC=value
R=value

specifies a small positive number r as the margin of error for measuring the accuracy of estimation of the quantile. By default, ACCURACY=0.005.

EPSILON=value
EPS=value

specifies the tolerance level (epsilon, a small positive number) for the stationary test. By default, EPSILON=0.001.

PROBABILITY=value
PROB=value
S=value

specifies the probability s of attaining the accuracy of the estimation of the quantile. By default, PROBABILITY=0.95.

QUANTILE=value
QUANT=value
Q=value

specifies the order (q, a value between 0 and 1) of the quantile of interest. By default, QUANTILE=0.025.

SUMMARIES <(MAXLAG=value)>
SUMMARY <(MAXLAG=value)>
SUM <(MAXLAG=value)>

computes a summary of MCMC diagnostics for each parameter in the Markov chain, including effective sample size (ESS), Monte Carlo standard error (MCSE), and related diagnostics. For more information about ESS, see the section Effective Sample Size in Chapter 2, Introduction to Bayesian Analysis Procedures; for more information about MCSE, see the section Standard Error of the Mean Estimate in Chapter 2, Introduction to Bayesian Analysis Procedures. MAXLAG=value specifies the maximum autocorrelation lag to use for computing ESS, which is used to compute MCSE, where value must be a positive integer. By default, MAXLAG=250.

By default, DIAGNOSTICS=SUMMARIES.

NBURNIN=number
BURNIN=number
NBI=number

specifies the number of burn-in iterations to perform in each Markov chain before the chains are saved. For more information, see the section Burn-In, Thinning, and Markov Chain Samples in Chapter 2, Introduction to Bayesian Analysis Procedures. By default, NBURNIN=0.

NCHAIN=number
NCHAINS=number
CHAINS=number

specifies the number of Markov chains to run. By default, NCHAIN=1.

NSAMPLE=number
NSAM=number
NMC=number

specifies the number of iterations after tuning and burn-in to save in each Markov chain. For more information, see the section Burn-In, Thinning, and Markov Chain Samples in Chapter 2, Introduction to Bayesian Analysis Procedures. By default, NSAMPLE=1000.

OUTPOST<(outpost-option)>=libref.data-table

names the SAS data table to contain the posterior sample. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs. You can specify the following outpost-option:

DETAILED

saves any relevant additional variables, such as auxiliary variables, in the SAS data table. The random walk Metropolis (RWM) sampler without the TRANSFORM option has no additional variables to save. With the TRANSFORM option, the SAS data table also includes the transformed version of each parameter and the log posterior of the transformed parameters.

SAMPLER=RWM <(rwm-options)>
SAMPLING=RWM <(rwm-options)>

samples from the posterior distribution by using the random walk Metropolis scheme. You can specify the following rwm-options:

ACCTOL=value
ATOL=value

specifies the tolerance epsilon for the acceptance rate during the tuning process of the random walk Metropolis (RWM) sampler. For more information, see the section Scale Tuning in Chapter 2, Introduction to Bayesian Analysis Procedures. By d efault, ACCTOL=0.075.

INITSCALE=value
SCALE=value

specifies the initial scale parameter(s) c Superscript cur of the RWM proposal distribution. For more information, see the section Scale Tuning in Chapter 2, Introduction to Bayesian Analysis Procedures. By default, INITSCALE=2.38.

NTUNE=number
NTU=number

specifies the number of iterations, n Subscript tune, to perform for each tuning stage of the random walk Metropolis sampler. For more information, see the section Tuning Random Walk Metropolis Algorithms in Chapter 2, Introduction to Bayesian Analysis Procedures. By default, NTUNE=500.

NTUNESTAGE=number

specifies the number of tuning stages, n Subscript stage. For more information, see the section Tuning Random Walk Metropolis Algorithms in Chapter 2, Introduction to Bayesian Analysis Procedures. By default, NTUNESTAGE=24.

TARGETRATE=value
RATE=value
DELTA=value

specifies the target acceptance rate delta of the random walk Metropolis sampler. For more information, see the section Tuning Random Walk Metropolis Algorithms in Chapter 2, Introduction to Bayesian Analysis Procedures. By default, TARGETRATE=0.234.

TRANSFORM
TRANS

transforms all parameters to an unconstrained space and implements the random walk Metropolis sampler on the unconstrained space. For more information, see the section Parameter Transformation in Chapter 2, Introduction to Bayesian Analysis Procedures.

TUNEWEIGHT=value
WEIGHT=value
WT=value

specifies the tuning weight w to use during the tuning phase of the random walk Metropolis sampler to tune the proposal covariance matrix. For more information, see the section Covariance Tuning in Chapter 2, Introduction to Bayesian Analysis Procedures. By default, TUNEWEIGHT=0.75.

SAMPLERSETTINGS
SAMSETTINGS
SAMSET

produces a summary of the MCMC sampler settings to be used to sample from the posterior distribution, including tuning settings.

SAMPLERSUMMARY
SAMSUMMARY
SAMSUM

produces a summary of the MCMC sampler to be used to sample from the posterior distribution, including, for example, Metropolis acceptance rates.

SEED=number

specifies an integer seed in the range 1 to 2 Superscript 31 Baseline minus 1 to use for the random number generator in the simulation. Specifying a seed enables you to reproduce identical Markov chains for the same specification. If you omit this option, or if you specify a non-positive seed, the seed specified in the PROC SMC statement is used.

STATISTICS<(stat-option)>=ALL | NONE | keyword | (keyword-list)
STATISTIC<(stat-option)>=ALL | NONE | keyword | (keyword-list)
STATS<(stat-option)>=ALL | NONE | keyword | (keyword-list)
STAT<(stat-option)>=ALL | NONE | keyword | (keyword-list)

specifies which posterior summary statistics to produce. If the value of the NCHAIN= option is greater than 1, then instead of the posterior summary statistics being computed separately for each Markov chain, by default the posterior summary statistics ar e computed by using all chains. For more information, see the section Using Multiple Chains in Chapter 2, Introduction to Bayesian Analysis Procedures. You can specify the following stat-option:

BYCHAIN

produces posterior summary statistics tables for each Markov chain. If NCHAIN=1, then the BYCHAIN option does nothing.

To produce all statistics, specify STATISTICS=ALL. To produce no statistics, specify STATISTICS=NONE. To produce some but not all statistics, or to change certain settings of these statistics, specify one or more of the following keywords. If you specify multiple keywords, separate them by using spaces.

CORR
COR

produces the posterior correlation matrix.

COV

produces the posterior covariance matrix.

INTERVAL <(interval-option)>
INTERVALS <(interval-option)>
INT <(interval-option)>

produces equal-tail posterior credible intervals and highest posterior density (HPD) credible intervals. For more information, see the sections Interval Estimation and Summary Statistics in Chapter 2, Introduction to Bayesian Analysis Procedures. You can specify the following interval-option:

ALPHA=numeric-list
ALPHAS=numeric-list

computes posterior credible intervals at the levels that you specify in the numeric-list. Values in the numeric-list must be between 0 and 1, and they can be separated either by spaces or by commas. Repeated values are removed. Each value in the numeric-list produces a pair of 100(1–value)% equal-tail and HPD intervals for each parameter. By default, ALPHA=0.05, which yields the 95% credible intervals for each parameter.

SUMMARIES <(summary-option)>
SUMMARY <(summary-option)>
SUM <(summary-option)>

produces the means, standard deviations, and percentiles for the posterior sample. For more information, see the section Summary Statistics in Chapter 2, Introduction to Bayesian Analysis Procedures. You can specify the following summary-option:

PERCENTILES=numeric-list
PERCENTILE=numeric-list
PERCENT=numeric-list
PERC=numeric-list
PCT=numeric-list

computes the percentiles of the posterior sample that you specify in the numeric-list. Values in the numeric-list must be between 0 and 100, and they can be separated either by spaces or by commas. Repeated values are removed. By default, PERCENTILES=(2.5 25 50 75 97.5), which yields the 2.5th, 25th, 50th, 75th, and 97.5th percentiles, respectively, for each parameter.

The posterior mean and median are two point estimates that you can use in the EVALUATE, FILTER, FORECAST, and SMOOTH statements (see the PARM= option for each of those statements). Therefore, the 50th percentile of the posterior sample is always computed whether it is specified in the numeric-list or not.

By default, STATISTICS=SUMMARIES.

THIN=k
THINNING=k

thins the Markov chain by using only one of every k iterations. For more information, see the section Burn-In, Thinning, and Markov Chain Samples in Chapter 2, Introduction to Bayesian Analysis Procedures. By default, THIN=1.

Last updated: July 09, 2026