CNTSELECT Procedure
BAYES Statement
BAYES <options>;
The BAYES statement controls the Markov chain Monte Carlo sampling scheme that is used to obtain samples from the posterior distribution of the underlying model and data. The BAYES statement is incompatible with the BOUNDS, DISPMODEL, RESTRICT, SELECTION, and TEST statements and with Conway-Maxwell-Poisson and panel models. You can specify the following options:
-
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 combined 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:
-
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
such that if the halfwidth is less than
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
level
for the halfwidth test. By default, HALFWIDTH_ALPHA=0.05.
-
STATIONARY_ALPHA=value
SALPHA=value specifies the
level
for the stationarity test. By default, STATIONARY_ALPHA=0.05.
-
EPSILON=value
-
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 (
, 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.
-
ACCURACY=value
-
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.
-
DISTRIBUTED
DISTRIBUTE keeps the data in the input table distributed on the CAS server when the server runs in massively parallel processing (MPP) mode. If you omit this option, instead the data are copied onto each worker for Bayesian inference, and multiple Markov chains are run in parallel. This option is ignored when the CAS server runs in symmetric multiprocessing (SMP) mode. For more information, see the section Distributed Data and MCMC.
-
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-options)>=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-options:
- 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. When you use the No-U-Turn Sampler (NUTS) by specifying the SAMPLER=NUTS option, the SAS data table includes those additional variables, as well as the tree height that is achieved at every iteration.
- WARMUP
saves warmup (tuning and burn-in) iterations in the SAS data table. This option is not available for the random walk Metropolis (RWM) sampler.
-
PRIORSUMMARY <(priorsum-option)>
PRIORSUM <(priorsum-option)> -
produces a summary of all parameters in the model and their prior distributions. You can specify the following priorsum-option:
-
SHOWNAMES
NAMES adds a column that displays the names of all parameters in the model. These are the names that you use to specify prior distributions on those parameters.
-
SHOWNAMES
-
SAMPLER=NUTS <(nuts-options)> | RWM <(rwm-options)>
SAMPLING=NUTS <(nuts-options)> | RWM <(rwm-options)> -
specifies how to sample from the posterior distribution. By default, SAMPLER=RWM.
- NUTS <(nuts-options)>
-
samples from the posterior distribution by using the No-U-Turn Sampler. You can specify the following nuts-options:
-
DELTA=number
TARGETRATE=number
RATE=number specifies the target Metropolis acceptance rate
for the No-U-Turn Sampler. For more information, see the section Tuning the No-U-Turn Sampler. By default, DELTA=0.8.
- MASSTUNE=NONE | WINDOWED <(windowed-options)>
-
specifies the mass matrix tuning method for the No-U-Turn Sampler. For more information, see the section Tuning the No-U-Turn Sampler. By default, MASSTUNE=WINDOWED. You can specify the following values:
- NONE
specifies no mass matrix tuning. For more information, see the section Tuning the No-U-Turn Sampler.
-
WINDOWED <(windowed-options)>
WINDOW <(windowed-options)>
WIN <(windowed-options)> -
specifies the windowed mass matrix tuning method. For more information, see the section Tuning the No-U-Turn Sampler. You can specify the following windowed-options:
-
EXPANDRATE=number
EXPRATE=number
RATE=number specifies the window expansion rate
for the windowed mass matrix tuning method. For more information, see the section Tuning the No-U-Turn Sampler. By default, EXPANDRATE=2.
-
FINALWINDOW=number
FINAL=number specifies the size of the final tuning window
for the windowed mass matrix tuning method. For more information, see the section Tuning the No-U-Turn Sampler. By default, FINALWINDOW=50.
-
INITWINDOW=number
INIT=number specifies the size of the initial tuning window
for the windowed mass matrix tuning method. For more information, see the section Tuning the No-U-Turn Sampler. By default, INITWINDOW=75.
-
MIDWINDOW=number
MID=number specifies the size of the first middle tuning window
for the windowed mass matrix tuning method. For more information, see the section Tuning the No-U-Turn Sampler. By default, MIDWINDOW=25.
-
OVERLAPPING
OVERLAP
OVER uses overlapping windows for the windowed mass matrix tuning method. For more information, see the section Tuning the No-U-Turn Sampler.
-
EXPANDRATE=number
-
MAXHEIGHT=number
MAXDEPTH=number
MAXTREE=number specifies the maximum height of the binary tree
for the No-U-Turn Sampler. For more information, see the section Tuning the No-U-Turn Sampler. To see how many times the algorithm reaches the maximum tree height during sampling, use the SAMPLERSUMMARY option. By default, MAXHEIGHT=10.
-
MAXHEIGHTKILL=k | INFINITY
MAXDEPTHKILL=k | INFINITY
MAXTREEKILL=k | INFINITY -
specifies the maximum number of times the No-U-Turn Sampler can reach the maximum binary tree height before the simulation stops. To see how many times the algorithm reaches the maximum tree height during sampling, use the SAMPLERSUMMARY option. For more information, see the section Tuning the No-U-Turn Sampler. You can specify the following values:
- k
specifies the maximum number of times. If k=0, then there is no maximum.
-
INFINITY
INFTY
INF specifies no maximum number of times.
By default, MAXHEIGHTKILL=0.
-
NTUNE=number
NTU=number specifies the number of iterations
for the No-U-Turn Sampler. For more information, see the section Tuning the No-U-Turn Sampler. By default, NTUNE=2000.
-
DELTA=number
- RWM <(rwm-options)>
-
samples from the posterior distribution by using the random walk Metropolis scheme. You can specify the following rmw-options:
-
ACCTOL=value
ATOL=value specifies the tolerance
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 default, ACCTOL=0.075.
-
INITSCALE=value
SCALE=value specifies the initial scale parameter(s)
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
for each tuning stage of the random walk Metropolis sampler. For more information, see the section Tuning the Random Walk Metropolis Sampler. By default, NTUNE=500.
- NTUNESTAGE=number
specifies the number of tuning stages
. For more information, see the section Tuning the Random Walk Metropolis Sampler. By default, NTUNESTAGE=24.
-
TARGETRATE=value
RATE=value
DELTA=value specifies the target acceptance rate
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.
-
ACCTOL=value
-
SAMPLERSETTINGS
SAMSETTINGS
SAMSET produces a summary of the MCMC sampler settings that are used to sample from the posterior distribution, including tuning settings.
-
SAMPLERSUMMARY<(VERBOSE)>
SAMSUMMARY<(VERBOSE)>
SAMSUM<(VERBOSE)> -
produces a summary of the MCMC sampler that is used to sample from the posterior distribution. For the RWM sampler, this option produces a table of the Metropolis acceptance rates. For NUTS, this option produces a table of the Metropolis acceptance rates as well as a table of NUTS diagnostics. You can specify the following suboption:
- VERBOSE
produces a more detailed summary of the MCMC sampler. For the RWM sampler, this option does nothing. For NUTS, this option produces a table of the final mass matrix that is used after tuning. For more information, see the section Tuning the No-U-Turn Sampler.
- SEED=number
specifies an integer seed in the range 1 to
for the random number generator in the simulation. Specifying a seed enables you to reproduce identical Markov chains for the same specification. If you do not specify this option, or if you specify a nonpositive seed, a random seed is generated by reading the time of day from the computer’s clock.
-
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 are 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. Elements in the numeric-list must be between 0 and 1, and values 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.
-
ALPHA=numeric-list
-
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. Elements in the numeric-list must be between 0 and 100, and values 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.
-
PERCENTILES=numeric-list
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.