The 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 <(SETTINGS)>=ALL | NONE | keyword-list | (keyword-list)
DIAG<(SETTINGS)>=ALL | NONE | keyword-list | (keyword-list) -
specifies which diagnostics to produce. 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 half-width is less than
times the sample mean of the retained iterates, the half-width test is passed. By default, EPSILON=0.1.
-
HALFWIDTH_ALPHA=value
HALPHA=value specifies the
level
for the half-width 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 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. If you also specify the SETTINGS option, then PROC CNTSELECT additionally produces a table of all MCMC diagnostic settings.
-
AUTOCORR <(LAGS=numeric-list)>
-
NBURNIN=number
BURNIN=number
NBI=number specifies the number of burn-in iterations before the chain is 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.
- NSAMPLE=number
-
NSAM=number
NMC=number specifies the number of iterations after warmup (tuning and burn-in) to be saved. 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)>=CAS-libref.data-table
-
names the SAS data table to contain the posterior sample. CAS-libref.data-table is a two-level name, where CAS-libref refers to the
casliband session identifier, 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.
-
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=RWM <(rwm-options)>
SAMPLING=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 Proposal Distribution. By default, NTUNE=500.
- NTUNESTAGE=number
specifies the number of tuning stages
. For more information, see the section Tuning the Proposal Distribution. 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
SAMSUMMARY
SAMSUM produces a summary of the MCMC sampler that is used to sample from the posterior distribution, including, for example, Metropolis acceptance rates.
- 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=ALL | NONE | keyword | (keyword-list)
STATISTIC=ALL | NONE | keyword | (keyword-list)
STATS=ALL | NONE | keyword | (keyword-list)
STAT=ALL | NONE | keyword | (keyword-list) -
specifies which posterior summary statistics to produce. 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.
-
CORR
-
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.