Stata 15 help for bayes_logit

[BAYES] bayes: logit -- Bayesian logistic regression, reporting coefficients

Syntax

bayes [, bayesopts] : logit depvar [indepvars] [if] [in] [weight] [, options]

options Description ------------------------------------------------------------------------- Model noconstant suppress constant term offset(varname) include varname in model with coefficient constrained to 1 asis retain perfect predictor variables collinear keep collinear variables

Reporting or report odds ratios display_options control spacing, line width, and base and empty cells

level(#) set credible level; default is level(95) ------------------------------------------------------------------------- indepvars may contain factor variables; see fvvarlist. depvar and indepvars may contain time-series operators; see tsvarlist. fweights are allowed; see weight. bayes: logit, level() is equivalent to bayes, clevel(): logit. For a detailed description of options, see Options in [R] logit.

bayesopts Description ------------------------------------------------------------------------- Priors * normalprior(#) specify standard deviation of default normal priors for regression coefficients; default is normalprior(100)

prior(priorspec) prior for model parameters; this option may be repeated dryrun show model summary without estimation

Simulation mcmcsize(#) MCMC sample size; default is mcmcsize(10000) burnin(#) burn-in period; default is burnin(2500) thinning(#) thinning interval; default is thinning(1) rseed(#) random-number seed exclude(paramref) specify model parameters to be excluded from the simulation results

Blocking * blocksize(#) maximum block size; default is blocksize(50) block(paramref[, blockopts]) specify a block of model parameters; this option may be repeated blocksummary display block summary * noblocking do not block parameters by default

Initialization initial(initspec) initial values for model parameters nomleinitial suppress the use of maximum likelihood estimates as starting values initrandom specify random initial values initsummary display initial values used for simulation * noisily display output from the estimation command during initialization

Adaptation adaptation(adaptopts) control the adaptive MCMC procedure scale(#) initial multiplier for scale factor; default is scale(2.38) covariance(cov) initial proposal covariance; default is the identity matrix

Reporting clevel(#) set credible interval level; default is clevel(95) hpd display HPD credible intervals instead of the default equal-tailed credible intervals * or report odds ratios eform[(string)] report exponentiated coefficients and, optionally, label as string batch(#) specify length of block for batch-means calculations; default is batch(0) saving(filename[, replace]) save simulation results to filename.dta nomodelsummary suppress model summary dots display dots every 100 iterations and iteration numbers every 1,000 iterations dots(#[, every(#)]) display dots as simulation is performed [no]show(paramref) specify model parameters to be excluded from or included in the output notable suppress estimation table noheader suppress output header title(string) display string as title above the table of parameter estimates display_options control spacing, line width, and base and empty cells

Advanced search(search_options) control the search for feasible initial values corrlag(#) specify maximum autocorrelation lag; default varies corrtol(#) specify autocorrelation tolerance; default is corrtol(0.01) ------------------------------------------------------------------------- * Starred options are specific to the bayes prefix; other options are common between bayes and bayesmh. Options prior() and block() can be repeated. priorspec and paramref are defined in [BAYES] bayesmh. paramref may contain factor variables; see fvvarlist. See [BAYES] bayesian postestimation for features available after estimation. Model parameters are regression coefficients {depvar:indepvars}. Use the dryrun option to see the definitions of model parameters prior to estimation. For a detailed description of bayesopts, see Options in [BAYES] bayes.

Menu

Statistics > Binary outcomes > Bayesian regression > Logistic regression

Description

bayes: logit fits a Bayesian logistic regression to a binary outcome; see [BAYES] bayes and [R] logit for details.

Examples: Logistic regression

Setup . webuse lbw

Fit Bayesian logistic regression using default priors . bayes: logit low age lwt i.race

Display odds ratios instead of coefficients . bayes, or

Increase the burn-in period to 5,000 from the default of 2,500 . bayes, burnin(5000): logit low age lwt i.race

Same as above, but use standard deviation of 10 of the default normal prior for regression coefficients . bayes, normalprior(10) burnin(5000): logit low age lwt i.race

Same as above, but also specify random-number seed for reproducibility . bayes, normalprior(10) burnin(5000) rseed(12345): logit low age lwt i.race

Fit Bayesian logistic regression using uniform priors for all regression coefficients . bayes, prior({low:age lwt i.race _cons}, uniform(-10,10)): logit low age lwt i.race

Same as above, but use a shortcut notation to refer to all regression coefficients . bayes, prior({low:}, uniform(-10,10)): logit low age lwt i.race

Save MCMC results on replay . bayes, saving(mymcmc)

Examples: Handling perfect prediction

Setup . webuse heartswitz

Fit Bayesian logistic regression using default noninformative priors . bayes: logit disease restecg isfbs age male

Same as above, but specify option noisily to display the output of the logit command . bayes, noisily: logit disease restecg isfbs age male

Specifying informative priors based on a similar study to resolve a problem of perfect prediction; specify logit's asis option to prevent logit from dropping the perfect predictors from the model, and specify bayes's nomleinitial option to prevent bayes from trying to obtain ML estimates as starting values . bayes, prior({disease:restecg age}, normal(0,10)) prior({disease:isfbs male}, normal(1,10)) prior({disease:_cons}, normal(-4,10)) nomleinitial: logit disease restecg isfbs age male, asis

Stored results

See Stored results in [BAYES] bayesmh.


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index