Home
User Manual for the Windows R Version of BACC (Bayesian
Contents
1. o o e 40 2 15 1 Dimension parameters eee eee ee 40 2 15 2 Unknown Quantities 0 00000 eee eee 40 2 15 3 Known Quantities on ra e be eee eee fia 40 2 15 4 Data Generating Process 0 000000 00008 40 DAB O Ae whe ee a AA 40 2 15 6 Creating a Model Instance o o 40 2 15 7 Sampling Algorithms 000000000 41 The Univariate Latent Linear Model with Student distributed disturbances o o e 42 2 16 1 Dimension parameters ee 42 2 16 2 Unknown Quantities 0 00000 2 ee eee 42 2 16 3 Known Quantities e 42 2 16 4 Data Generating Process 0 00000 0000004 42 216 00 Priors aoa it da oly cd ge a A 42 2 16 6 Creating a Model Instance o o 42 2 16 7 Sampling Algorithms e 43 CONTENTS 2 17 A Univariate Linear Model with Finite Mixtures of Normals Disturbances 44 2 18 The Dichotomous Choice Model with a scale mixture of normals distribution for the disturbances 46 2 18 1 Dimension parameters o 46 2 18 2 Unknown Quantities e 46 2 18 3 Known Quantities e 46 2 18 4 Data Generating Process o 46 E o A 46 2 18 6 Creating a Model Instance o o e 47 2 18 7 Sampling Algorithms eee eee 47 2
2. Ktype K uniform K t X 1 1 t 1 oa lt x 1 1 t biweight K t 1 2 x 11 triangle K t II For any set S the function xs is a set membership indicator function The value h is given by h X qa q1 where qa denotes the a th sample quantile of z The weightedSmooth command generates N ordered pairs 2 y The values x are evenly spaced between min and maz determined by Krange according to Table 3 2 The values y satisfy y f 2 Table 3 2 Values of Krange Krange Tin Emar quantile qa qaz absolute ay a2 For most plotting routines N should be in the range of 200 to 400 The choice of A depends on how smooth the resulting plot is desired to be As with all kernel smoothing methods some experimentation will probably be necessary The greater the number of simulations available the smaller A can be and still retain visual smoothness It is generally easier to use the Krange quantile option and specify a in the range 001 to 01 and az in the range 99 to 999 this will include the important part of the estimated density while not wasting space on the plot for points where the density is small 90 CHAPTER 3 BACC COMMANDS 3 3 26 The wishartSim Command Description Generates a sample from a Wishart distribution Usage sample lt wishartSim A nu n Inputs A m by m matrix inverse scale parameter of Wishart distribution nu Real scalar degrees of fre
3. See Also setseedconstant Example setseedtime Details This is useful for ensuring that repeated invocations of a command generating random values lead to different results 87 88 CHAPTER 3 BACC COMMANDS 3 3 25 The weightedSmooth Command Description Estimates a univariate density function for a weighted random sample using a kernel smoothing algorithm adapted to weighted samples Usage out lt weightedSmooth logWeight sample ktype uniform krange quantile wwf 0 5 nplot 1000 range_al 0 001 range_a2 0 009 Inputs logWeight Vector of length M log weights sample Vector of length M a posterior sample of some function of in terest ktype String kernel type optional krange String kernel range type optional wwf Real scalar window width fraction optional nplot Integer number of ordered pairs to generate optional range_al Real scalar left bound range parameter optional range_a2 Real scalar right bound range parameter optional Outputs x Vector of length N ordinate values y Vector of length N abscissa values Example out lt weightedSmooth lw z nplot lt 2000 ktype lt triangular out lt weightedSmooth lw z Details The estimated density at a point z is D Wi K 52 O Wm The functional form of the kernel function K depends on the value of ktype according to Table 3 1 f z 3 3 DETAILED DESCRIPTION OF COMMANDS 89 Table 3 1 Values of Ktype
4. 2 6 THE STATIONARY FIRST ORDER MARKOV FINITE STATE MODEL 23 2 6 6 Creating a Model Instance The mnemonic label identifying the model is sfomfs Supply the name you wish to give the unknown quantity P Supply the known quantities in the following order a S 2 6 7 Sampling Algorithms Generating Prior Draws Samples from the prior distribution of P are generated independently Generating Posterior Draws In this model an independance Metropolis Hastings chain is used to draw from the posterior distribution for P The distribution P S of candidate draws is PI S Di s s 1 m where a a n Qs i Asi Asm n11 Nim n gt ml Mmm where nss is the number of transitions from state s to state s in the data The Hastings ratio for this block is given by N ME jaa Su 24 CHAPTER 2 MODELS 2 7 The Poisson Model 2 7 1 Dimension parameters There are N observations 2 7 2 Unknown Quantities Unknown Parameters There is a scalar mean parameter A 2 7 3 Known Quantities Prior Parameters There is a scalar shape parameter gt 0 and a scalar scale parameter P gt 0 indexing the prior distribution of A Data Each observation x is a non negative integer T 2 7 4 Data Generating Process The observations x are independently and identically Poisson distributed 2 7 5 Priors Gala b 2 7 6 Creating a Model Instance The mnemonic label identifying the model is poisson Supply the na
5. e 32 2 11 2 Unknown Quantities e 32 2113 Known Quantities 2 2 20 Pa ir tas BS el a 32 2 11 4 Data Generating Process o e 32 Dl o la adie tek Bok kD fy te AS MM Mot e ho do SAA 32 2 11 6 Creating a Model Instance o o 32 2 11 7 Sampling Algorithms e 33 The Univariate Latent Linear Model with normally distributed disturbances o o o 34 2 12 1 Dimension parameters e 34 2 12 2 Unknown Quantities e 34 212 3 Known Quantities my a a e Da amp Sears 34 2 12 4 Data Generating Process o 0 00000 00000088 34 A o AE oid ate eae ke ed kB kD By tA MMe th A 34 2 12 6 Creating a Model Instance o o 34 2 12 7 ssaimpling Al orithims tete eo da ee eee A A 35 A Univariate Linear Model with Student t Disturbances 36 The Dichotomous Choice Model with Student distributed disturbances o o e 38 2 14 1 Dimension parameters e eee eee 38 2 14 2 Unknown Quantities e 38 2 14 3 Known Quantities e 38 2 14 4 Data Generating Process o 0000000000008 38 DAA Priors se ehh ah ooh ant ROA EG Be Bed Bi phic ee Ae Ne eect Te ey BS 38 2 14 6 Creating a Model Instance o o e 38 2 14 7 Sampling Algorithms e 39 The Censored Linear Model with Student distributed disturbances
6. hState for example and finally the name of the latent outcome variable y yTilde for example Supply the known quantities in the following order 6 Ha Hg S V Sj Vj t X y 2 18 7 Sampling Algorithms See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 48 CHAPTER 2 MODELS 2 19 The Censored Linear Model with a scale mixture of normals distribution for the disturbances 2 19 1 Dimension parameters There are k covariate coefficients T observations of each variable and m components for the mixture of normals i e m states 2 19 2 Unknown Quantities Unknown Parameters There is a k x 1 coefficient parameter y a scalar precision parameter h a T x 1 vector of state indices a 1 x m vector of probabilities an m x 1 vector of precision parameters hj and a T x 1 vector y of possibly latent outcomes 2 19 3 Known Quantities Prior Parameters There is a k x 1 coefficient mean vector 3 a positive scalar precision parameter H a k x k positive definite coefficient matrix H F a precision degrees of freedom parameter y a positive definite precision inverse scale parameter S an m x 1 vector of precision degrees of freedom parameters v an m x 1 vector of positive definite precision inverse scale parameter Sj a 1 x m vector of hyperparameters r and a censoring parameter c Data There is a T x 1 ve
7. names Label associated with values 3 Concatenating vectors z lt c x1 x2 z is the vector obtained by vertically stacking x1 and x2 e Matrices 1 Creating a matrix B 2 DATA OBJECTS 101 Create a 6 by 2 matrix using the values of z The first column of z1 is equal to x1 and the second column is equal to x2 zi lt matrix z 6 2 z1 1 First column of z1 equal to x1 Create a 2 by 6 matrix using the values of z The first row of z2 is equal to x1 and the second row is equal to x2 z2 lt matrix z 2 6 byrow T z2 1 First row of z2 equal to x1 2 Attributes of a matrix length The total number of element length z1 Returns 12 length z2 Returns 12 mode As above dim The number of rows and columns of a matrix dim z1 Return the vector 6 2 nrow z1 Returns the number of rows of z1 i e 6 ncol z1 Returns the number of columns of zi i e 2 dimnames The row and column names 3 some other manipulations of matrices z3 is z2 reshaped to have dimensions 3 by 4 z3 lt matrix z2 3 4 z4 is the transpose of z2 z4 lt t z2 Indexing the elements of a matrix z1 1 First column of z1 z2 1 First row of z2 e arrays 102 APPENDIX B A BRIEF S PLUS R TUTORIAL Arrays are like matrices but with an arbitrary number of dimensions The examples for matrices above can be generalized for arrays e lists Unlike vectors matrices and arrays lis
8. together with X are mutually independant The covariate coefficient vector 3 has distribution N P H y p B 2n H exp 6 BY Hs 8 B 2 The precision parameter h has a scaled chi squared distribution with s h y p h 22PT 1 2 7 8 Ph exp s h 2 The time varying latent precision parameters h are ii d scaled chi squared variates with Ahi A T p R A PLAYA TT ap ap Ah 2 t 1 The degrees of freedom parameter A is distributed exp A p A A exp A d Sampling Algorithm See Section 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 38 CHAPTER 2 MODELS 2 14 The Dichotomous Choice Model with Student distributed disturbances 2 14 1 Dimension parameters There are k covariate coefficients and T observations of each variable 2 14 2 Unknown Quantities Unknown Parameters There is a k x 1 coefficient parameter 8 a scalar precision parameter h a T x 1 vector of precision parameters h a T x 1 vector y of latent outcomes and a scalar degrees of freedom parameter A 2 14 3 Known Quantities Prior Parameters There is a k x 1 coefficient mean vector 3 a k x k positive definite coefficient matrix Hz a precision degrees of freedom parameter y a positive definite precision inverse scale parameter S and a degrees of freedom parameter A Data There is a T x 1 vector of observatio
9. estimated combined weighted sample means nse Vector of length K 1 estimated numerical standard errors equal Vector of length K 1 marginal significance levels for a chi squared test of the equality of the population means See Also expectl Example Use default taper values out lt expectN lw1 z1 1w2 22 Use alternate taper values taper array c 4 0 8 0 dim c 1 2 out lt expectN lw1 z1 1w2 z2 taper 64 CHAPTER 3 BACC COMMANDS Details In general there are N pairs of weighted samples not just two For each sample z expectN calculates individual sample moments 2 and estimates of numerical standard errors r a T 10 from the samples e ae i 20 the log weights log ZO log z0 ay nd the half taper values A1 Ax in the same way that expected eAlonlates z and 70 Tk from 21 2Zn2 log 21 log zm and A1 Ax The estimated sample means Z are given by Z Xal a 20 220 k 1 K we k The estimated numerical standard errors T are given by For each k the marginal significance level is the value of pz such that z a Zz 2 _ 2 Ss q k ara Ma ot ay 2 znd where X is the following matrix POLO pO 0 PA 0 0 O POLPO RO 0 0 0 49 OO 0 0 0 0 0 qo 4 72N D EN 0 0 0 72ND rN 2 Go 3 3 DETAILED DESCRIPTION OF COMMANDS 65 3 3 4 The extract Command Description Returns simulation matrices for a model instance Usage s
10. Contents Important Information 1 Getting Started with BACC LL Introductions s apati A aoe eee A A A 12 Requirements soaa psa de de e tt ho A a A a 1 3 Installation and ConfiguratioL e 2 Models 2 1 Introduction is re k A A A A A a EG 2 1 1 Dimension parameters e 212 Unknown Quantiti s 2 2 a ee ee ee aa AA 21 3 Known Quantities a sor e BK eee AA A ee eee Yeas 2 1 4 Data Generating Process o e o 210 Rrior Distributione uu we a EA 2 1 6 Creating a Model Imstance o o FLT Sampling Algorithms s sse OR tata g 2 1 8 Marginal Likelihood o o o 2 2 The Normal Linear Model 0 0 0000200002 2a ee 2 2 1 Dimension parameters 00000 2 eee eee ee 2 2 2 Unknown Quantities 0000000 ee eee 223 Known Quantities exceso a 2 2 4 Data Generating Process o 0 000000 00 0G 23200 Priors a eats Ae hog Rh ete pa ha ter des tera eth Bee ee ee A Baa ae 2 2 6 Creating a Model Instance oaoa 0 000008 2 2 7 Sampling Algorithms 0 0 0 000000000 2 3 The Seemingly Unrelated Regressions Model 2 4 ThelLI D Finite State Model o e e 2 4 1 Dimension parameters e 2 4 2 Unknown Quantities o 2 43 Known Quantities serae a a a a a 2 4 4 Data Generating Process o o 000000084 DAD Priors ds Mow a A A A A AA 2 4 6 Creati
11. freedom of h 35 1x1 prior inverse scale of h pxi prior mean of before truncation H pxp prior precision of before truncation X TxK covariates y Tx1 dependant variable 2 21 4 Data Generating Process The data generating process is given by Y B i 2 21 AN AUTOREGRESSION MODEL 53 where x is the t th row of X as a column vector p amp gt QPiEt i Ut i l and uz iid N 0 h7 2 21 5 Prior Distribution The unknowns are a priori independent and have the following distributions b N B Hz 3h X D The prior for is obtained by truncating the following density to the region for which y is stationary ESE N 6 HG 2 21 6 Creating a Model Instance The mnemonic label identifying the model is AR Supply the names you wish to give the unknown quantities in the same order as they appear in the table of unknown quantities Supply the known quantities in the same order as they appear in the table of known quantities 2 21 7 Sampling Algorithm The sampling algorithm for prior simulation features three blocks each making independent draws from the prior distribution of one of the unknown quantities The sampling algorithm for posterior simulation features three blocks each making draws from the conditional pos terior distribution of one of the unknown quantities 54 CHAPTER 2 MODELS 2 22 An Autoregression Model with State Dependant Means 2 22 1 Dimension Parameters T
12. nom M11 Nim n Maa E in where nos is the number of individuals starting in state s and nss is the number of transi tions from state s to state s in the data Posterior samples are drawn independently from this distribution 2 5 8 Marginal Likelihood The marginal likelihood is available in closed form a ro Qos EP 1 Gos de D a Mga T ss WS a ra 11 Ea IP Foy TO Sew s 1 22 CHAPTER 2 MODELS 2 6 The Stationary First Order Markov Finite State Model 2 6 1 Dimension parameters There are m states N individuals and T observation times 2 6 2 Unknown Quantities Unknown Parameters There is an m x m Markov transition probability matrix P 2 6 3 Known Quantities Prior Parameters The prior parameter is an m x m matrix q indexing the prior distribution of P Data There are state observations si 1 m for each individual and each observation time t 11 SIN S sri STN 2 6 4 Data Generating Process The N observation sequences s 7_ are i i d with each sequence being first order Markov with transition matrix P The initial distribution vector is assumed to be the invariant distribution 7 for P Pr si 8 Ts s 1 m Pr s 9 s 1 8 Pag where 7 is the left eigenvector of P corresponding to the eigenvalue 1 2 6 5 Priors The m rows P of P are mutually independent and have the following marginal distributions P Ps1 Pem Di a s 1 m
13. postsim Command Description Generates or appends to the posterior simulation matrix of a given model in stance Usage postsim modelInst m n Inputs model Inst Integer model instance identifier m Integer number of posterior draws to record n Integer number of posterior draws to generate for each one recorded Outputs None See Also minst postfilter mlike priorsim postsimHM extract Example postsim mi 1000 1 Details Generates draws of unknown quantities from their posterior distribution Gen erates mn new posterior draws and appends every nth draw to the posterior simulation matrix If there are any draws from a previous invocation of postsim the first new draw comes from the transition kernel of the Markov chain used for posterior simulation Otherwise it comes from the initial distribution of the Markov chain Use the extract command to obtain the posterior draws 3 3 DETAILED DESCRIPTION OF COMMANDS 81 3 3 19 The postsimHM Command Description Generates or appends to the posterior HM simulation matrix of a given model instance Usage postsimHM modelInst m n scalePrecision Inputs model Inst Integer model instance identifier m Integer number of posterior draws to record n Integer number of posterior draws to generate for each one recorded scalePrecision Real scalar factor used to rescale the precision matrix of the random walk innovation Outputs None See Also
14. 0 000 3 3 18 The postsim Command 3 3 19 The postsimHM Command 2 2 00000 3 3 20 The priorRobust Command 0 0 0 0004 3 3 21 The priorfilter Command 0 000 3 3 22 The priorsim Command 0 020000 3 3 23 The setseedconstant Command 00004 3 3 24 The setseedtime Command 000000 e 3 3 25 The weightedSmooth Command 000 3 3 26 The wishartSim Command 00 4 A BACC Tutorial 4 1 Working through a model instance o ee 4 2 Simulating from various distributions A Distributions A 1 The Dirichlet Distribution A 2 The Gamma Distribution A 3 The Normal Distribution A 4 The Pareto Distribution e o A 5 The Poisson Distribution A 6 The Wishart Distribution B A Brief S PLUS R Tutorial B 1 Basic syntax of expressions e ee B 2 Datavobjects tada ad ae Sencha ee ee a a 10 Bibliography CONTENTS 103 Chapter 1 Getting Started with BACC 1 1 Introduction The BACC software provides the user several commands for doing Bayesian analysis and communications This document describes the function of these commands and their in puts and outputs It also outlines some of the theory behind the commands and provides references to the relevant literature The following versions of the BACC software and documentation are availa
15. 1 vector of precision parameters hj and a T x 1 vector y of latent outcomes 2 18 3 Known Quantities Prior Parameters There is a k x 1 coefficient mean vector 3 a positive scalar precision parameter H a k x k positive definite coefficient matrix H F a precision degrees of freedom parameter v a positive definite precision inverse scale parameter S an m x 1 vector of precision degrees of freedom parameters v an mx 1 vector of positive definite precision inverse scale parameter Sj and a 1 x m vector of hyperparameters r Data There is a T x 1 vector of observations of dependent variables y taking values in 0 1 There is a T x k matrix X of observations of ancillary with respect to unknown quan tities variables 2 18 4 Data Generating Process See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 18 5 Priors See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 18 THE DICHOTOMOUS CHOICE MODEL WITH A SCALE MIXTURE OF NORMALS DISTRIBUTION FO 2 18 6 Creating a Model Instance The mnemonic label identifying the model is fmn_udcht Supply the names you wish to give the unknown quantities in the following order first the name of y gamma for example then the name of s then the name of p then the name of h
16. 19 The Censored Linear Model with a scale mixture of normals distribution for the disturbances 48 2 19 1 Dimension parameters 0 000000 ee eee 48 2 19 2 Unknown Quantities e 48 2219 3 Know Quantities Zine as a ey oh ee Sl Ads A 48 2 19 4 Data Generating Process 20 000000000084 48 251925 ON 48 2 19 6 Creating a Model Instante o o e 49 2 19 7 Sampling Algorithms e 49 2 20 The Univariate Latent Linear Model with a scale mixture of normals distribution for the disturbances 50 2 20 1 Dimension parameters e 50 2 20 2 Unknown Quantities e 50 2 20 3 Known Quantities ee 50 2 20 4 Data Generating Process o e 0000000 G 50 22005 Priors nd poate BRA dede cee ele bet its 50 2 20 6 Creating a Model Instante oo o e 51 2 20 7 Sampling Algorithms 51 2 21 An Autoregression Model e 52 2 21 1 Dimension Parameters o e a 000000000 52 2 21 2 Unknown Quantities o 52 2 21 3 Known Quantities sit 446 eq BHR ee bo ee ARES a 52 2 21 4 Data Generating Process o 00000004 52 2 21 59 Prior Distribution s an sisira teks ten o Gia arene e eee BA BAe a 53 2 21 6 Creating a Model Instante o o e 53 2 21 7 Sampling Altor hm se eerie ge es SS eee PAAR A OA A 53 2 22 An Aut
17. C R Chapter 2 Models 2 1 Introduction This document specifies the models currently supported by the BACC system Each sec tion following this one describes one of the supported models Each model description is organized into subsections following the pattern of this section Appendix A gives the probability density and mass functions of the distributions used throughout the document 2 1 1 Dimension parameters All the quantities relevant to a model are treated as matrix valued All matrix sizes are specified in terms of these dimension parameters Examples of dimension parameters include the number of times a variable is observed the number of individuals in a cross section and the number of equations in a linear model This subsection lists and describes the dimension parameters for a particular model 2 1 2 Unknown Quantities Unknown quantities are all the unobserved elements in a model They include unknown parameters of the model latent variables and missing data Separate sub sub sections discuss unknown quantities in each of these categories Posterior simulation involves drawing these quantities from their posterior distribution that is their conditional distribution given known quantities 2 1 3 Known Quantities Known quantities are all the observed or user specified values in a model They include prior parameters which index distributions within a family of prior distributions and observed data Separate sub su
18. Hetero for example then the name of the latent variable y yTilde for example and finally the name of the degrees of freedom parameter A lambda for example Supply the known quantities in the following order 6 Hg S v A X y 2 15 THE CENSORED LINEAR MODEL WITH STUDENT T DISTRIBUTED DISTURBANCES 1 2 15 7 Sampling Algorithms See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 42 CHAPTER 2 MODELS 2 16 The Univariate Latent Linear Model with Student distributed disturbances 2 16 1 Dimension parameters There are k covariate coefficients and T observations of each variable 2 16 2 Unknown Quantities Unknown Parameters There is a k x 1 coefficient parameter a scalar precision parameter h a T x 1 vector of precision parameters h a T x 1 vector y of possibly latent outcomes and a scalar degrees of freedom parameter A 2 16 3 Known Quantities Prior Parameters There is a k x 1 coefficient mean vector 3 a k x k positive definite coefficient matrix Hz a precision degrees of freedom parameter y a positive definite precision inverse scale parameter S and a degrees of freedom parameter A Data Corresponding to the possibly latent outcome y there are two T x 1 vectors c and d c gt d which describe the observed set valued outcome There is a T x k matrix X of observations o
19. NEAR MODEL WITH NORMALLY DISTRIBUTED DISTURBANCES 35 2 12 7 Sampling Algorithms See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 36 CHAPTER 2 MODELS 2 13 A Univariate Linear Model with Student t Distur bances The mnemonic label identifying the model is t_ulm Dimension Parameters T number of observations K number of covariates Unknown Quantities K x 1 vector of covariate coefficients p h 1x1 precision of Student t distribution h Tx1 time varying latent precision variable A 1x1 degrees of freedom of Student t distribution Known Quantities B Kk x1 prior mean of 8 Hg Kx K prior precision of 3 1x1 prior inverse scale of h v 1x1 prior degrees of freedom of h A 1x1 prior mean of A X TxK covariates y Tx 1 dependant variable Data Generating Process The observables y are given by y XP u where uisa Tx 1 vector of independant Student t disturbances with u h X t 0 AGA Conditioning on the latent h gives u h h N 0 hht dE p u X 8 h h 20 T R TT hi exp hhru 2 t 1 See Section 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html for details 2 13 A UNIVARIATE LINEAR MODEL WITH STUDENT T DISTURBANCES 37 Prior Distribution The vectors 3 h and h A
20. S v When m 1 the distribution of SH is chi squared with y degrees of freedom 16 CHAPTER 2 MODELS 2 2 6 Creating a Model Instance The mnemonic label identifying the model is nlm Supply the names you wish to give the unknown quantities in the following order first the name of 8 beta for example and then the name of H Supply the known quantities in the following order 6 H y v S Z y 2 2 7 Sampling Algorithms Generating Prior Samples Samples from the prior distribution of 6 and H are generated independently Generating Posterior Samples The algorithm to generate samples from the posterior distribution 6 H Z y is a Gibbs sam pling algorithm with two blocks based on the following conditional posterior distributions el H S y Z W S 7 where Hg H Z H amp Ir Z 2 H H Z H 8 Ir y 2 3 THE SEEMINGLY UNRELATED REGRESSIONS MODEL 2 3 The Seemingly Unrelated Regressions Model This is a special case of the Normal Linear Model with m gt 1 Please see section 2 2 17 18 CHAPTER 2 MODELS 2 4 The I I D Finite State Model 2 4 1 Dimension parameters There are m states N individuals and T observation times 2 4 2 Unknown Quantities Unknown Parameters There is a 1 x m state probability vector r 2 4 3 Known Quantities Prior Parameters There is a 1 x m parameter q indexing the prior distribution of r Data There are state observations sy 1 m for each indi
21. User Manual for the Windows R Version of BACC Bayesian Analysis Computation and Communication Wei Chen William McCausland John J Stevens October 29 2003 Important Information About this Manual This manual describes the software developed in connection with the project Bayesian Com munication in the Social Sciences Siddhartha Chib and John Geweke principle investigators Acknowledgement in any resulting published work would be appreciated This project was supported in part by Grants SBR 9600040 and SBR 9731037 from the National Science Foundation Help Keep This Software Free The National Science Foundation supports this software and its continued development It is important that we document the use of BACC We respectfully request that all publications and working papers reporting the results of research using BACC software include the following acknowledgement and reference Computations reported in this paper were undertaken in part using the Bayesian Analysis Computation and Communication software http www econ umn edu bacc described in Geweke J 1999 Using Simulation Methods for Bayesian Econo metric Models Inference Development and Communication with discussion and rejoinder Econometric Reviews 18 1 126 BACC Software and Documentation BACC software and documentation is available on the web at http www econ umn edu bacc Please send any comments or questions to bacc econ umn edu
22. ameter c Data There is a T x 1 vector of observations of dependent variables y There is a T x k matrix X of observations of ancillary with respect to unknown quan tities variables 2 11 4 Data Generating Process See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 11 5 Priors See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 11 6 Creating a Model Instance The mnemonic label identifying the model is ucensor Supply the names you wish to give the unknown quantities in the following order first the name of 8 beta for example then the name of h hHomo for example and finally the name of the latent variable y yTilde for example Supply the known quantities in the following order P Hg S v c X y 2 11 THE CENSORED LINEAR MODEL WITH NORMALLY DISTRIBUTED DISTURBANCES 33 2 11 7 Sampling Algorithms See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 34 CHAPTER 2 MODELS 2 12 The Univariate Latent Linear Model with normally distributed disturbances 2 12 1 Dimension parameters There are k covariate coefficients and T observations of each variable 2 12 2 Unknown Quantitie
23. ating a Model Instance oaoa o 24 20 Sampling Algorithms ea Goa AA e ete de eh ee SS 24 2 0 8 Marginal likelihood tenas se seno Geto eee ee en a A E E A 25 The Uniform Model 0002000000000 26 2 8 1 Dimension parameters 0 000 2 eee eee ee 26 2 8 2 Unknown Quantities 0 00000 2 eee eee 26 2 8 3 Known Quantities e 26 2 8 4 Data Generating Process o 0000000000004 26 2 8 5 CPOS ga aie gt Road gee cele ee Ge a A ee te hone Hg 26 2 8 6 Creating a Model Instante o o 26 2 8 7 Sampling Algorithms e 27 2 8 8 Marginal Likelihood lt lt 27 A Univariate Linear Model with Normal Disturbances 28 The Dichotomous Choice Model with normally distributed disturbances 00 4 30 2 10 1 Dimension parameters 0 0 0000 eee eee 30 2 10 2 Unknown Quantities e 30 2 10 3 Known Quantities 0 ca kik Be ee ee wae Ae 30 2 10 4 Data Generating Process o 0 000000 00000084 30 20D DLOLS a a 8 dh a al 8 nd da oy a acs See BS Bee RE vg ak aS A 30 2 10 6 Creating a Model Instante o o 0 00000 30 2 10 7 Sampling Algorithms e 31 CONTENTS 2 11 2 12 2 13 2 14 2 15 2 16 7 The Censored Linear Model with normally distributed disturbances o o e 32 2 11 1 Dimension parameters
24. ation matrix of a given model instance Usage priorsim modelInst m n Inputs model Inst Integer model instance identifier m Integer number of prior draws to record n Integer number of prior draws to generate for each one recorded Outputs None See Also minst priorfilter postsim extract Example priorsim mi 1000 1 Details Generates draws of unknown quantities from their prior distribution Generates mn new prior draws and appends every nth draw to the prior simulation matrix If there are any draws from a previous invocation of priorsim the first new draw comes from the transition kernel of the Markov chain used for prior simulation Otherwise it comes from the initial distribution of the Markov chain Use the extract command to obtain the prior draws 86 CHAPTER 3 BACC COMMANDS 3 3 23 The setseedconstant Command Description Sets the seeds of the random number generators to a constant value Usage setseedconstant Inputs None Outputs None See Also setseedtime Example setseedconstant Details This is useful for ensuring that repeated invocations of a command generating random values lead to the same results 3 3 DETAILED DESCRIPTION OF COMMANDS 3 3 24 The setseedtime Command Description Sets the seeds of the random number generators to the number of seconds since the beginning of 1970 Usage setseedtime Inputs None Outputs None
25. b sections discuss known quantities in both of these categories The user of the BACC software must specify all the known quantities of a model in order to create an instance of the model 13 14 CHAPTER 2 MODELS 2 1 4 Data Generating Process This section specifies the conditional distribution of the endogenous observed data given the unknown quantities and any observed data ancillary with respect to the unknown quantities 2 1 5 Prior Distribution This section specifies the marginal distribution of the unknown quantities reflecting the user s prior beliefs about these quantities These unknown quantities may or may not be independent An example where they are not is a hierarchical prior in which the prior density is expressed as the product of marginal densities of the lowest level unknowns and conditional densities of higher level unknowns given lower level unknowns 2 1 6 Creating a Model Instance This section gives all the model specific information a user requires to create a model instance It specifies a short mnemonic label that identifies the model the order in which the user gives the names to assign the unknown quantities and the order in which to supply all the known quantities To create a model instance the user issues the minst command with appropriate arguments see section 3 3 14 2 1 7 Sampling Algorithms This section has brief descriptions of the algorithm used to generate samples of unknow
26. bability density function is Ago 9 gt B pla 8 otherwise The mean and variance are given by ap El la 8 Sl a3 Var 6 a 8 D A 5 The Poisson Distribution A discrete random variable x has the Poisson distribution with mean parameter A gt 0 denoted x Po A if its probability mass function is eA xe 0 1 p x 0 otherwise A 6 THE WISHART DISTRIBUTION 97 The mean and variance are given by E x A Var x A A 6 The Wishart Distribution An m x m random matrix H has the Wishart distribution with positive definite m x m scale parameter matrix A and degrees of freedom parameter v gt m denoted H Wi A v if its probability density function is nom m 1 4 A72 p H A v AAA A 0 otherwise a H exp 4tr A71H H p d The mean and mean of the matrix H7 are given by E A A v vA 1 A v m 1 E 4 74 1 98 APPENDIX A DISTRIBUTIONS Appendix B A Brief S PLUS R Tutorial This section gives a brief overview of S PLUS and R commands and their data types It is not intended to be a complete tutorial Consult the S PLUS and R manuals for further information You can find S PLUS manuals at URL http www splus mathsoft com splus resources doc and R manuals at URL http lib stat cmu edu R CRAN contents html doc B 1 Basic syntax of expressions Variable names in S PLUS and R are case sensitive so that x and X are different A function cal
27. ble e Windows Matlab e Linux Unix Matlab e Windows Splus e Linux Unix Splus e Windows R e Linux Unix R e Windows Gauss e Linux Unix Gauss e Windows Console e Linux Unix Console This particular manual is for the Windows R version of BACC 1 2 Requirements 1 3 Installation and Configuration Follow these steps to install the Windows R version of BACC 11 12 CHAPTER 1 GETTING STARTED WITH BACC 1 Download the zip file baccWinR zip from the software page of the BACC website http www econ umn edu bacc 2 Unzip baccWinR zip to the directory C X using a standard unzipping utility such as PKZIP available at http www pkware com Other freeware and shareware unzipping utilities are available on the web This creates the directory C BACC_R and fills it with all the necessary files You may also install the software into an alternative directory in which case the following steps need to be modified accordingly The Windows R version of BACC is now installed Follow these steps to load the BACC library within R 1 Start R 2 Change working directory to BACC_R load the R script baccWin R and load the dy namically linked library for BACC gt setwd C BACC_R gt source baccWin R gt loadBACC Follow these steps to run the sample program testBACC R 1 Set the working directory to C BACC_R Test gt setwd C BACC_R Test 2 Run the R script testBACC R gt source testBAC
28. cale 10 1000 n cat wishart mean n apply sample 2 mean n Appendix A Distributions This appendix gives the density and mass functions for the distributions used in this docu ment A 1 The Dirichlet Distribution A random vector 7 of length n has the Dirichlet distribution with parameter vector a R denoted a Di a if its probability density function is mi e ntt E A pert Dep l 0 otherwise p rla The mean and variance are given by Qi Da Qj Efr a 1 Efr a 1 D aj El r la Elr a 1 en Qk E r la Varl r la Covlr 7 a A 2 The Gamma Distribution A random scalar A has the Gamma distribution with shape parameter a gt 0 and scale parameter 8 gt 0 denoted A Ga a 3 if its probability density function is Pe eM NSO p la B lt E 0 otherwise 95 96 APPENDIX A DISTRIBUTIONS The mean and variance are given by Ella 6 5 Var Ala 6 5 A 3 The Normal Distribution A random vector x has the Normal Distribution with mean parameter vector y R and positive definite k x k variance parameter matrix denoted x N u 2 if its probability density function is l amp 1 I 11 n dela E Ham E exp 0 Eo veen The mean and variane are given by Elx 2 u Var zx u 2 E A 4 The Pareto Distribution A random scalar x has the Pareto Distribution with parameters a gt 0 and 8 gt 0 denoted 6 Pala 8 if its pro
29. ces html 2 20 THE UNIVARIATE LATENT LINEAR MODEL WITH A SCALE MIXTURE OF NORMALS DISTRIBUTI 2 20 6 Creating a Model Instance The mnemonic label identifying the model is fmn_ul1nm Supply the names you wish to give the unknown quantities in the following order first the name of y gamma for example then the name of s then the name of p then the name of hj hState for example and finally the name of the outcome variable y yTilde for example Supply the known quantities in the following order y Ha Hg S Y Sj Vj T X c d 2 20 7 Sampling Algorithms See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 52 CHAPTER 2 MODELS 2 21 An Autoregression Model 2 21 1 Dimension Parameters The model features the following dimension parameters Dimension Parameter Description T number of observations K number of covariates p autoregressive order 2 21 2 Unknown Quantities The model features the following unknown quantities Unknown Quantity Dimensions Description 16 Kxl covariate coefficient vector h 1x1 residual precision oO pxl vector of autoregression coefficients 2 21 3 Known Quantities The model features the following known quantities Known Quantity Dimensions Description B Kxi1 prior mean of 8 H B KxK prior precision of 3 D 1x1 prior degrees of
30. ch k 1 K estimates 0 d t based on the taper 0 Var n t 03 Varla t wd Ona Cov n t half width Az Ak 1 a Tan r Yan 0 Aa an s Ak a Oaa ky Yaal0 2 De vaa s Fadik Yna 0 EA yna s van s These calculations are based on conventional time series methods for a wide sense stationary process described in Geweke 1992 4 By the conventional asymptotic expansion the square of the numerical standard error is approximated by 2 1 n O Ond a Var 4 3 d d d d 2 antl nd Od d2 For each k 1 K it calculates the approximation 7 using Tn k dt and 0 a n defined above Relative numerical efficiencies vo vg are calculated using 3 3 DETAILED DESCRIPTION OF COMMANDS 63 3 3 3 The expectN Command Description Calculates combined sample means with numerical standard errors for a set of different weighted random samples and tests for the equality of their individual population means Usage out lt expectN logWeight1 samplel logWeight2 sample2 taper c 4 0 8 0 15 0 Inputs logWeight1 Vector of length M log sample weights for first sample samplel Vector of length M first sample of scalar draws logWeight2 Vector of length M log sample weights for second sample sample2 Vector of length M2 second sample of scalar draws taper Vector of length K taper half widths optional Outputs mean Vector of length K 1
31. covariates m number of mixture components or states Unknown Quantities y m K x1 vector of state means and covariate coefficients h 1 x 1 constant multiplicative precision component h m x 1 state dependant multiplicative precision component 5 T x1 time varying latent discrete state T 1 x m state probabilities Known Quantities a 1x1 prior precision parameter for state means 6 Kx1 prior mean of covariate coefficients Ha Kx K prior precision of covariate coefficients 1x1 prior inverse scale of h v 1x1 prior degrees of freedom of h m 1x1 number of states v 1x1 degrees of freedom parameter for state precisions r 1x1 Dirichlet parameter for state probabilities X TxK covariates y Tx 1 dependant variable Data Generating Process The observables y are given by y XP u 2 17 A UNIVARIATE LINEAR MODEL WITH FINITE MIXTURES OF NORMALS DISTURBANCES45 where wu is a T x 1 vector of independant discrete normal mixture disturbances with ulh 7 a h X given by p uz h r a h X 2r 12h Y rh exp h hj us aj 2 j 1 Conditioning on the latent states gives p u h o h X 27 214032 exp h his u 05 2 See Section 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html for details Prior Distribution The vectors y h h and 3 7 together with X are mutually independant The y
32. ctor of observations of dependent variables y There is a T x k matrix X of observations of ancillary with respect to unknown quan tities variables 2 19 4 Data Generating Process See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 19 5 Priors See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 19 THE CENSORED LINEAR MODEL WITH A SCALE MIXTURE OF NORMALS DISTRIBUTION FOR TH 2 19 6 Creating a Model Instance The mnemonic label identifying the model is fmn_ucensor Supply the names you wish to give the unknown quantities in the following order first the name of y gamma for example then the name of s then the name of p then the name of hj hState for example and finally the name of the outcome variable y yTilde for example Supply the known quantities in the following order 6 Ha Hg S V Sj Vj T X y 2 19 7 Sampling Algorithms See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 50 CHAPTER 2 MODELS 2 20 The Univariate Latent Linear Model with a scale mixture of normals distribution for the disturbances 2 20 1 Dimension parameters There are k covariate coeff
33. der a 3 X 2 8 THE UNIFORM MODEL 27 2 8 7 Sampling Algorithms Generating Prior Samples Samples from the prior distribution of 0 are generated independently Generating Posterior Samples In this model the posterior distribution for 0 is the following familiar distribution 0 X Pa a 8 where a a N B max 8 maxi l Posterior samples are drawn independently from this distribution 2 8 8 Marginal Likelihood The marginal likelihood is given by the following expression N p X a a 2 8 i 1 where 8 max 8 max 25 j lt i and P3 TE aeo 1 otherwise 28 2 9 A Univariate Linear Model with bances The mnemonic label identifying the model is n_ulm Dimension Parameters T number of observations K number of covariates Unknown Quantities B Kx1 vector of covariate coefficients h 1x1 precision of disturbance Known Quantities B Kx1 prior mean of p Ha Kx K prior precision of 3 2 1x1 prior inverse scale of h Iw IX 1x1 prior degrees of freedom of h X TxK covariates y Tx 1 dependant variable Data Generating Process The observables y are given by y XP u CHAPTER 2 MODELS Normal Distur where wu is a T x 1 vector of i i d normal disturbances with u h N 0 h7 p ulX B h 27m 2AT7 exp hu u 2 Prior Distribution The vectors 8 and h together with X are mutually independant The covariate coefficient vector 6 has distrib
34. e Also paretoSim gaussianSim gammaSim wishartSin Example A array c 1 0 2 0 3 0 4 0 5 0 6 0 dim c 2 3 sample lt dirichletSim A 1000 Details The sample consists of n draws Each of the n draws of the sample is an m by K matrix with independent rows Each row has a Dirichlet distribution with parameters given by the corresponding row of A The result is given as a n by mK matrix and each column gives a draw in column major order See Appendix A for the parameterization of the Dirichlet distribution 60 CHAPTER 3 BACC COMMANDS 3 3 2 The expect1 Command Description Calculates for a weighted random sample the sample mean and standard devi ation estimates of the numerical standard error for the mean and estimates of the relative numerical efficiency Usage out lt expecti logWeight sample taper c 4 0 8 0 15 0 Inputs logWeight Vector of length M log sample weights sample Vector of length M sample of scalar draws taper Vector of length K taper half widths optional Outputs mean Real scalar weighted sample mean std Real scalar weighted sample standard deviation nse Vector of length K 1 estimated numerical standard errors rne Vector of length K 1 estimated relative numerical efficiency See Also expectN priorRobust Example Use default taper values out lt expecti lw z Use alternate taper values taper array c 4 0 8 0 dim c 1 2 out lt expectN lw
35. edom parameter of Wishart distribu tion n Integer number of draws to generate Outputs sample n by m matrix sample generated from Wishart distribution See Also paretoSim gaussianSim gammaSim dirichletSin Example A array c 1 0 0 0 0 0 1 0 dim c 2 2 nu lt 100 sample lt wishartSim A nu 1000 Details Each of the n draws of the sample is an m by m matrix with a Wishart distri bution The result is given as a m by m matrix See Appendix A for the parametrization of the Wishart distribution Chapter 4 A BACC Tutorial In order to answer commonly asked questions this chapter contains a step by step tutorial with explanations of what each step is doing and what each term means 91 92 CHAPTER 4 A BACC TUTORIAL 4 1 Working through a model instance Before creating a model instance you need to load all the know quantities These quantities can be either vector or matrix data objects The following code demonstrates how a normal linear model called sim is created and manipulated Specify the names for the unknown quantities unknownNames lt c beta h Specify the known quantities of the model instance Only the name of the data objects are accepted These data objects must be preloaded knowns lt list betahd Hhd nuhd shd Xhd yhd Creat an instance of the normal linear model modelInst lt minst nlm unknownNames knowns Simulate 5000 prior samples setseedconstant pr
36. ee Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 10 6 Creating a Model Instance The mnemonic label identifying the model is udcht Supply the names you wish to give the unknown quantities in the following order first the name of 8 beta for example then the name of h hHomo for example and finally the name of the latent variable y yTilde for example Supply the known quantities in the following order P H y S v X y 2 10 THE DICHOTOMOUS CHOICE MODEL WITH NORMALLY DISTRIBUTED DISTURBANCES 31 2 10 7 Sampling Algorithms See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 32 CHAPTER 2 MODELS 2 11 The Censored Linear Model with normally distributed disturbances 2 11 1 Dimension parameters There are k covariate coefficients and T observations of each variable 2 11 2 Unknown Quantities Unknown Parameters There is a k x 1 coefficient parameter 6 a scalar precision parameter h and a T x 1 vector y of possibly latent outcomes 2 11 3 Known Quantities Prior Parameters There is a k x 1 coefficient mean vector P a k x k positive definite coefficient matrix Hg a precision degrees of freedom parameter y a positive definite precision inverse scale parameter S and a censoring par
37. ere are k covariate coefficients and T observations of each variable 2 15 2 Unknown Quantities Unknown Parameters There is a k x 1 coefficient parameter P a scalar precision parameter h a T x 1 vector of precision parameters h a T x 1 vector y of possibly latent outcomes and a scalar degrees of freedom parameter A 2 15 3 Known Quantities Prior Parameters There is a k x 1 coefficient mean vector 3 a k x k positive definite coefficient matrix 3 a precision degrees of freedom parameter y a positive definite precision inverse scale parameter S a degrees of freedom parameter A and a censoring parameter c Data There is a T x 1 vector of observations of dependent variables y There is a T x k matrix X of observations of ancillary with respect to unknown quan tities variables 2 15 4 Data Generating Process See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 15 5 Priors See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 15 6 Creating a Model Instance The mnemonic label identifying the model is t_ucensor Supply the names you wish to give the unknown quantities in the following order first the name of 8 beta for example then the name of h hHomo for example then the name of h h
38. erned about standard errors it is best to use several values of p for example p 0 1 0 2 0 9 78 CHAPTER 3 BACC COMMANDS 3 3 16 The paretoSim Command Description Generates a sample from a Pareto distribution Usage sample lt paretoSim alpha beta n Inputs alpha Real scalar tail parameter of Pareto distribution beta Real scalar location parameter of Pareto distribution n Integer number of draws to generate Outputs sample n by 1 matrix sample generated from Pareto distribution See Also dirichletSim gaussianSim gammaSim wishartSin Example alpha lt 1 0 beta lt 4 0 sample lt gammaSim alpha beta 1000 Details Each of the n draws of the sample is a scalar with a pareto distribution The result is given as a n by 1 matrix See Appendix A for the parametrization of the Pareto distribution 3 3 DETAILED DESCRIPTION OF COMMANDS 79 3 3 17 The postfilter Command Description Filters out previously generated draws from the posterior simulation matrix of a given model instance Usage postfilter modelInst filter Inputs model Inst Integer model instance identifier filter Vector of integers of length n indices of existing draws to keep Outputs None Example filter seq 101 1000 postfilter mi filter Details The ith draw of the posterior simulation matrix is kept if and only if i fj for some j from 1 to n 80 CHAPTER 3 BACC COMMANDS 3 3 18 The
39. f ancillary with respect to unknown quan tities variables 2 16 4 Data Generating Process See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 16 5 Priors See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 16 6 Creating a Model Instance The mnemonic label identifying the model is t_u11m Supply the names you wish to give the unknown quantities in the following order first the name of 8 beta for example then the name of h hHomo for example then the name of h hHetero for example then the name of the latent variable y yTilde for example and finally the name of the degrees of freedom parameter A lambda for example 2 16 THE UNIVARIATE LATENT LINEAR MODEL WITH STUDENT T DISTRIBUTED DISTURBANCES 43 Supply the known quantities in the following order 6 Hg S v A X c d 2 16 7 Sampling Algorithms See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 44 CHAPTER 2 MODELS 2 17 A Univariate Linear Model with Finite Mixtures of Normals Disturbances The mnemonic label identifying the model is fmn_ulm Dimension Parameters T number of observations K number of
40. gth n asymptotic upper bounds Lt Vector of length n asymptotic lower bounds Example K array c 5 0 10 0 20 0 dim c 1 3 out lt priorRobust lw beta K Details For each bound factor calculates exact lower and upper bounds and asymptotic lower and upper bounds for the posterior mean For each bound parameter ki priorRobust calculates exact lower and upper bounds L and U for the posterior mean of the function of interest g for the following set of prior density kernels 1 where p is the actual prior density It uses the algorithm described in Geweke and Petrella 6 Also for each k priorRobust calculates asymptotically valid 3 3 DETAILED DESCRIPTION OF COMMANDS lower and upper bounds L and Us using the results of DeRobertis and Hartigan 1 83 84 CHAPTER 3 BACC COMMANDS 3 3 21 The priorfilter Command Description Filters out previously generated draws from the prior simulation matrix of a given model instance Usage priorfilter modelInst filter Inputs model Inst Integer model instance identifier filter Vector of integers of length n indices of existing draws to keep Outputs None Example filter seq 101 1000 priorfilter mi filter Details The ith draw of the prior simulation matrix is kept if and only if i fj for some j from 1 to n 3 3 DETAILED DESCRIPTION OF COMMANDS 85 3 3 22 The priorsim Command Description Generates or appends to the prior simul
41. he model features the following dimension parameters Dimension Parameter Description 23 AN number of observations number of covariates autoregressive order number of states 2 22 2 Unknown Quantities The model features the following unknown quantities Unknown Quantity Dimensions Description y m K x1 vertical stack of alpha and beta h 1x1 residual precision O pxl vector of autoregression coefficients P mxm state transition probability matrix s Txi latent states f Txm filter probabilities 2 22 3 Known Quantities The model features the following known quantities 2 22 AN AUTOREGRESSION MODEL WITH STATE DEPENDANT MEANS 55 Known Quantity Dimensions Description al m K x1 prior mean of y He m K x m K prior precision of y D 1x1 prior degrees of freedom of h 3 1x1 prior inverse scale of h pxl prior mean of before truncation H pxp prior precision of before truncation A mxm parameters of prior for P X TxK covariates y Tx1 dependant variable 2 22 4 Data Generating Process The data generating process is given by Yt As B E E where z is the tth row of X as a column vector and a m x 1 and 8 K x 1 are obtained by partitioning y p 5 Pieri Ut i 1 and uz iid N 0 h7 2 22 5 Prior Distribution The unknowns are a priori independent and have the following distributions gt l y NG H gt 3h x 5 The prior for is obtained by trunca
42. icients T observations of each variable and m components for the mixture of normals i e m states 2 20 2 Unknown Quantities Unknown Parameters There is a m k x 1 coefficient parameter y a scalar precision parameter h a T x 1 vector of state indices a 1 x m vector of probabilities an m x 1 vector of precision parameters hj and a T x 1 vector y of possibly latent outcomes 2 20 3 Known Quantities Prior Parameters There is a k x 1 coefficient mean vector 5 a positive scalar precision parameter H a k x k positive definite coefficient matrix H P a precision degrees of freedom parameter v a positive definite precision inverse scale parameter S an m x 1 vector of precision degrees of freedom parameters 1 an mx 1 vector of positive definite precision inverse scale parameter Sj and a 1 x m vector of hyperparameters r Data Corresponding to the possibly latent outcome y there are two T x 1 vectors c and d c gt d which describe the observed set valued outcome There is a T x k matrix X of observations of ancillary with respect to unknown quan tities variables 2 20 4 Data Generating Process See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 20 5 Priors See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resour
43. im lt extract modelInst Inputs model Inst Integer model instance identifier Outputs sim Structure simulation matrices Example sim lt extract mi Details The return value is a structure named list in S PLUS and R with the following fields components in S PLUS and R id Model instance identifier logWeightPost Log weights for posterior draws logPrior Value of log prior for posterior draws logXPrior Value of transformed log prior values for posterior draws logLike Value of log likelihood for posterior draws logPriorHM Value of log prior for posterior HM draws logLikeHM Value of log likelihood for posterior HM draws logWeightPrior Log weights for prior draws logPriorPrior Value of log prior for prior draws logLikePrior Value of log likelihood for prior draws Posterior simulation matrix of unknown quantity named Prior Prior simulation matrix of unknown quantity named HM Posterior HM simulation matrix of unknown quantity named All simulation matrices have three dimensions The first two dimensions give the row and column of the unknown quantity The third dimension is the simulation dimension Each value of the third index gives a different draw of the unknown quantity 66 CHAPTER 3 BACC COMMANDS 3 3 5 The gammaSim Command Description Generates a sample from a gamma distribution Usage sample lt gammaSim alpha beta n Inputs alpha Real scalar shape parameter of ga
44. iorsim modellInst 5000 1 Simulate 1000 posterior samples setseedconstant postsim modelInst 1000 1 Filter out the first 100 posterior samples f lt 101 1000 postfilter model f Add 4100 new posterior samples setseedconstant postsim modelInst 4100 1 Simulate 10000 new HM posterior samples setseedconstant postsimhm modelInst 10000 1 1 extract all the quantities related to the model created out lt extract modelInst Get the vector of posterior samples of the first element of beta betal lt out beta 1 1 4 1 WORKING THROUGH A MODEL INSTANCE 93 Get the vector of log weight evaluations lw lt out logweightPost Get the vector of prior samples of the first element of beta betap1 lt out betaPrior 1 1 Find the posterior mean and standard deviation of betal using the default value of taper exp1 lt expect1 lw beta1 The following four operations are only to demonstrate what are included in exp1 exp1 is good enough for use postmean lt exp1 mean poststd lt expi std postnse lt exp1 nse postrne lt exp1 rne Specify truncation parameters for marginal likelihood computation p lt 1 9 0 1 A short way to write p lt c 0 1 0 2 0 9 mlike out lt mlike modelInst p As expl it is sufficient to use mlike out to get the components Replace by ml m1NSE mlHM mlNSEHM as desired Specify the logweight and function of interest variables for e
45. l consists of a function name followed by an argument list which may be empty in parentheses setseedconstant plot smooth out gaussianSim mean precision 1000 One of the most frequently used operators is the assignment operator lt or _ If the value of a function is not assigned to an object using lt or _ it is automatically printed and stored as Last value When values returned by BACC functions are complicated objects it is a good idea to use an assignment statement to store them B 2 Data objects Data in S PLUS and R are organized into data objects Each data object has a name consisting of alphanumeric characters and periods Names cannot start with a number Four basic S PLUS R data objects are used in BACC commands 99 100 APPENDIX B A BRIEF S PLUS R TUTORIAL e Vectors 1 Creating a vector The following examples show some useful functions for creating vectors A vector with elements 1 2 3 4 5 x1 lt 1 5 A vector with elements 1 3 4 6 10 5 x2 lt c 1 3 4 6 10 5 A vector of strings y lt c Obs Age A vector with elements from 0 1 to 0 6 with step size 0 05 z lt seq 0 1 0 6 0 05 A zero vector of length 6 z lt rep 0 6 2 Attributes of a vector length The length of the vector length x1 Returns 5 length y Returns 2 mode One of numeric character logical or complex mode x1 Returns numeric mode y Returns character
46. mand Description Loads a model instance stored in a text file Usage modelInst lt miLoadAscii filename Inputs filename String name of text file storing the model instance Outputs model Inst Integer model instance identifier See Also miSaveAscii minst miLoad Example mi lt miLoadAscii miFile txt 3 3 DETAILED DESCRIPTION OF COMMANDS 3 3 12 The miSave Command Description Saves a model instance in a binary file Usage miSave modelInst filename Inputs model Inst Integer model instance identifier filename String name of binary file in which to store the model instance Outputs None See Also miLoad minst miSaveAscii Example miSave mi miFile Details If the file already exists it is written over 73 74 CHAPTER 3 BACC COMMANDS 3 3 13 The miSaveAscii Command Description Saves a model instance in a text file Usage miSaveAscii modelInst filename Inputs model Inst Integer model instance identifier filename String name of text file in which to store the model instance Outputs None See Also miLoadAscii minst miSave Example miSaveAscii mi miFile txt Details If the file already exists it is written over The ascii version of a model instance is platform independent and human readable but long and inefficient 3 3 DETAILED DESCRIPTION OF COMMANDS 75 3 3 14 The minst Command Description Creates an insta
47. mes you wish to give the unknown quantity A lambda for example Supply the known quantities in the following order a 3 X 2 7 7 Sampling Algorithms Generating Prior Samples Samples from the prior distribution of are generated independently 2 7 THE POISSON MODEL 25 Generating Posterior Samples In this model the posterior distribution for A is the following familiar distribution Posterior samples are drawn independently from this distribution 2 7 8 Marginal Likelihood The marginal likelihood is given by the following expression BN T a r 1 where N CS gt Ti i 1 26 CHAPTER 2 MODELS 2 8 The Uniform Model 2 8 1 Dimension parameters There are N observations 2 8 2 Unknown Quantities Unknown Parameters There is a scalar support parameter 6 2 8 3 Known Quantities Prior Parameters There is a scalar notional count parameter gt 0 and a scalar notional maximal element parameter 8 gt 0 indexing the prior distribution of 0 Data Each observation x is a non negative real valued scalar 2 8 4 Data Generating Process Each observation x is independently and identically distributed with a uniform distribution on 0 9 zi i i d U 0 8 2 8 5 Priors 0 Pala 3 2 8 6 Creating a Model Instance The mnemonic label identifying the model is uniform Supply the name you wish to give the unknown quantity 0 theta for example Supply the known quantities in the following or
48. minst mlike postsim extract Example postsimHM mi 1000 1 10 0 Details Generates draws of unknown quantities from their posterior distribution using a Gaussian random walk Metropolis chain with proposal covariance proportional to the sample covariance of draws from the posterior simulation matrix Generates mn new posterior draws and appends every nth draw to the posterior simulation matrix If there are any draws from a previous invocation of postsimHM the first new draw comes from the transition kernel of the Markov chain used for posterior simulation Otherwise it comes from the initial distribution of the Markov chain Use the extract command to obtain the posterior HM draws 82 CHAPTER 3 BACC COMMANDS 3 3 20 The priorRobust Command Description Calculates upper and lower bounds on the mean of a posterior function of inter est as the prior distribution is varied from its original specification Usage out lt priorRobust logWeight sample factors Inputs logWeight Vector of length m log weights sample Vector of length m posterior sample of some scalar function of interest factors Vector of length n bound factors for robustness analysis Outputs mean Real scalar posterior sample mean for original prior specification std Real scalar posterior sample standard deviation for original prior specification Vector of length n exact upper bounds L Vector of length n exact lower bounds Ut Vector of len
49. mma distribution beta Real scalar inverse scale parameter of gamma distribution n Integer number of draws to generate Outputs sample n by 1 matrix sample generated from gamma distribution See Also paretoSim gaussianSim dirichletSim wishartSim Example alpha lt 3 0 beta lt 5 0 sample lt gammaSim alpha beta 1000 Details Each of the n draws of the sample is a scalar with a gamma distribution The result is given as a n by 1 matrix See Appendix A for the parametrization of the gamma distribution 3 3 DETAILED DESCRIPTION OF COMMANDS 67 3 3 6 The gaussianSim Command Description Generates a sample from a Gaussian distribution Usage sample lt gaussianSim mean precision n Inputs mean Vector of length K mean of Gaussian distribution precision K by K matrix precision of Gaussian distribution n Integer number of draws to generate Outputs sample n by K matrix sample generated from Gaussian distribution See Also paretoSim dirichletSim gammaSim wishartSin Example mean array c 1 0 2 0 dim c 2 1 precision array c 1 0 0 0 0 0 1 0 dim c 2 2 sample lt gaussianSim mean precision 1000 Details Each of the n draws of the sample is a vector of length K with a Gaussian distribution The result is given as a n by K matrix See Appendix A for the parametrization of the Gaussian distribution 68 CHAPTER 3 BACC COMMANDS 3 3 7 The listModelSpecs Command Description Lis
50. n quantities from their prior and posterior distributions One subsection each concerns the prior distribution and the posterior distribution For further details on the algorithms the user should consult the internal source code documentation for the BACC system 2 1 8 Marginal Likelihood Where there is an analytical expression for the marginal likelihood in a model this subsection provides that expression 2 2 THE NORMAL LINEAR MODEL 15 2 2 The Normal Linear Model 2 2 1 Dimension parameters There are m equations k covariate coefficients and T observations of each variable 2 2 2 Unknown Quantities Unknown Parameters There is a k x 1 coefficient parameter 3 and a m x m precision parameter H 2 2 3 Known Quantities Prior Parameters There is a k x 1 coefficient mean vector 6 a k x k positive definite coefficient precision matrix H a precision degrees of freedom parameter y gt gt and a positive definite 2 precision inverse scale parameter S Data There are m vectors of observations of dependent variables y Ym Each vector is T x 1 There are m matrices of observations of ancillary with respect to unknown quantities variables Z1 Zm Each matrix is T x k 2 2 4 Data Generating Process y Z 1 y B ZP e Ym Lm Em 1 Li Em Zm 2 2 5 Priors The unknown parameters and H are a priori independent and have the following marginal distributions B N G Hz H Wi
51. nardo A P Dawid and A F M Smith eds Proceedings of the Fourth Valencia International Meeting on Bayesian Statistics 169 194 Oxford Oxford University Press Geweke J 1999 Simulation Based Bayesian Inference for Economic Time Series in R S Mariano T Schuermann and M Weeks eds Simulation Based Inference in Econometrics Methods and Applications Cambridge Cambridge University Press forthcoming Geweke J and L Petrella 1999 Prior Density Ratio Class Robustness in Economet rics Journal of Business and Economic Statistics forthcoming Raftery A E 1995 Hypothesis testing and model selection via posterior simulation University of Washington working paper 103
52. nce of a particular model specification Usage modelInst lt minst modelSpecName unknownNames knowns Inputs modelSpecName String name of model specification unknownNames List of strings user provided names for unknown quantities knowns List of matrices user provided matrices of known quantities Outputs model Inst Integer model instance identifier Example a array c 1 1 2 dim c 1 3 s array c 1 1 2 3 3 3 dim c 3 2 myMI lt minst iidfs pi a s Details The available model specifications are described in Chapter 2 For each model specification there is a section Creating a Model Instance with the relevant information namely e The name of the model specification e The order in which the user specifies the names for the unknown quantities of the model e The order in which the user provides the matrices giving the values of the known quantities of the model 76 CHAPTER 3 BACC COMMANDS 3 3 15 The mlike Command Description Computes various estimates of the marginal likelihood for a model instance with numerical standard errors Usage out lt mlike modelInst p c 0 1 0 5 0 9 taper c 4 0 8 0 15 0 Inputs model Inst Integer model instance identifier P Vector of length L truncation parameters optional taper Vector of length K taper half widths optional Outputs ml Vector of length L marginal likelihood estimates mlnse L by K 1 matrix numerical
53. nerates a sample from a multiple Dirichlet distribution Calculates for a weighted random sample the sample mean and stan dard deviation estimates of the numerical standard error for the mean and estimates of the relative numerical efficiency Calculates combined sample means with numerical standard errors for a set of different weighted random samples and tests for the equality of their individual population means Returns simulation matrices for a model instance Generates a sample from a gamma distribution Generates a sample from a Gaussian distribution Lists all available model specifications e g nlm poisson Lists all open model instances Closes without saving a or all model instances Loads a model instance stored in a binary file Loads a model instance stored in a text file Saves a model instance in a binary file Saves a model instance in a text file Creates an instance of a particular model specification 57 58 mlike paretoSim postfilter postsim postsimHM priorRobust priorfilter priorsim setseedconstant setseedtime weightedSmooth wishartSim CHAPTER 3 BACC COMMANDS Computes various estimates of the marginal likelihood for a model in stance with numerical standard errors Generates a sample from a Pareto distribution Filters out previously generated draws from the posterior simulation ma trix of a given model instance Generates or appends to the posterior sim
54. ng a Model Instance o o 2 4 7 Sampling Algorithms e 11 11 11 11 2 5 2 6 2 1 2 8 2 9 2 10 CONTENTS 2 4 8 Marginal Likelihood o o 0 0000 19 The Non Stationary First Order Markov Finite State Model 20 2 5 1 Dimension parameters a eee eee 20 2 5 2 Unknown Quantities 00000000 e eee 20 2 5 3 Known Quantities seria ea ee es See pa poeta SG eS ae 20 2 5 4 Data Generating Process o 0 000000 0000004 20 Deore SP o O Mod oh hed oo SAN 20 2 5 6 Creating a Model Instante o o 21 2 5 7 Sampling Algorithms o eee eee 21 2 5 8 Marginal Likelihood o 21 The Stationary First Order Markov Finite State Model 22 2 6 1 Dimension parameters e 22 2 6 2 Unknown Quantities o 0 000000 2 ee eee 22 26 3 Known QuU ntities ss e a ppp Rs da a ara 22 2 6 4 Data Generating Process o 00000004 22 A o E MM Mok dh dh he AR 22 2 6 6 Creating a Model Instante o o 0 000 23 26 0 sainpling Al orithms c eee Ge AA 23 The Poisson Model dada E a eaaa at G a a a 24 2 7 1 Dimension parameters a 24 2 7 2 Unknown Quantities EE E E a ee eee 24 2 7 3 Known Quantities aa aaa a a A A 24 2 7 4 Data Generating Process aooaa e 24 A A a a 24 2 7 6 Cre
55. ns of dependent variables y taking values in 0 1 There is a T x k matrix X of observations of ancillary with respect to unknown quan tities variables 2 14 4 Data Generating Process See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 14 5 Priors See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 14 6 Creating a Model Instance The mnemonic label identifying the model is t_udcht Supply the names you wish to give the unknown quantities in the following order first the name of 8 beta for example then the name of h hHomo for example then the name of hy hHetero for example then the name of the latent variable yTilde for example and finally the name of the degrees of freedom parameter A lambda for example Supply the known quantities in the following order 6 Hg S v A X y 2 14 THE DICHOTOMOUS CHOICE MODEL WITH STUDENT T DISTRIBUTED DISTURBANCES 39 2 14 7 Sampling Algorithms See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 40 CHAPTER 2 MODELS 2 15 The Censored Linear Model with Student distributed disturbances 2 15 1 Dimension parameters Th
56. oregression Model with State Dependant Means 54 2 22 1 Dimension Parameters 2 200 000 0000 00000 54 2 22 2 Unknown Quantities voir are ae eee aaa 54 2 22 3 Known Quantitles e e ede 26 644 44468 e eee eee dD eG 54 2 22 4 Data Generating Process o o 55 2222 5 Prior Distribution ocio a ee be ee eee ee AO 55 2 22 6 Creating a Model Instante o o 56 2 22 7 Sampling Algorithm e 56 CONTENTS 3 BACC Commands 3 1 Overview of BACC Commands o 3 2 Matlab Issues oi a a e A A a hy 3 3 Detailed Description of Commands e 3 3 1 The dirichletSim Command e 3 3 2 The expecti Command 0 2 000 3 3 3 The expectN Command 020000 3 3 4 The extract Command 3 3 5 The gammaSimCommand 000000 3 3 6 The gaussianSim Command 0 0 000 0 3 3 7 The listModelSpecs Command 00 3 3 8 The listModels Command 2 00 3 3 9 The miDelete Command e 3 3 10 The miLoad Command 00000 ee eee 3 3 11 The miLoadAscii Command e 3 3 12 The miSave Command 3 3 13 The miSaveAscii Command e 3 3 14 The minst Command 00000002 ee 3 3 15 The mlike Command 00000000005 3 3 16 The paretoSim Command 2 2 20000 3 3 17 The postfilter Command
57. pa rameter vertically stacks the parameters a and PB where a is the m x 1 vector of state dependant means and is the K x 1 vector of covariate coefficients They are independent with alh N 0 h h and 6 N B Hg p y1h p alh p B 27 P hh exp h ha a 2 20 EP1H 1 P exp 6 By Hs 8 8 2 The precision parameter h has a scaled chi squared distribution with s h v p h 22PT 1 2 U SLP NEAR exp s h 2 The state dependant precisions hj are i i d with v hj x v 9mv 2 mv 2 x 2 2 a f p h 272 T v 2 v II exp v h 2 j l The latent states are i i d with the probability Pr s j given by 7 for j 1 m T pln J rs t 1 The vector m of probabilities is distributed Dirichlet r r plr T mr r II ms Sampling Algorithm See section 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 46 CHAPTER 2 MODELS 2 18 The Dichotomous Choice Model with a scale mixture of normals distribution for the disturbances 2 18 1 Dimension parameters There are k covariate coefficients T observations of each variable and m components for the mixture of normals i e m states 2 18 2 Unknown Quantities Unknown Parameters There is a k x 1 coefficient parameter y a scalar precision parameter h a T x 1 vector of state indices a 1 x m vector of probabilities an m x
58. s Unknown Parameters There is a k x 1 coefficient parameter 3 a scalar precision parameter h and a T x 1 vector y of possibly latent outcomes 2 12 3 Known Quantities Prior Parameters There is a k x 1 coefficient mean vector P a k x k positive definite coefficient matrix H g a precision degrees of freedom parameter y and a positive definite precision inverse scale parameter S Data Corresponding to the possibly latent outcome y there are two T x 1 vectors c and d c gt d which describe the observed set valued outcome There is a T x k matrix X of observations of ancillary with respect to unknown quan tities variables 2 12 4 Data Generating Process See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 12 5 Priors See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 12 6 Creating a Model Instance The mnemonic label identifying the model is ul1m Supply the names you wish to give the unknown quantities in the following order first the name of 8 beta for example then the name of h hHomo for example and finally the name of the latent variable y yTilde for example Supply the known quantities in the following order 3 H y S v X c d 2 12 THE UNIVARIATE LATENT LI
59. standared error estimates See Also postsim postsimHM Example Use default truncation and taper values out lt mlike mi Use alternate truncation values p array c 0 1 0 3 0 5 0 7 0 9 dim c 1 5 out lt mlike mi p Use alternate truncation and taper values taper array c 4 0 8 0 dim c 1 2 out lt mlike mi p taper Details The method used is a modification described in Geweke 5 of the method pro posed in Gelfand and Dey 2 The truncation parameters p 0 1 index the truncated multivariate normal distribution f discussed in Geweke 5 For each p mlike generates inter nally an unweighted vector z 24 where M is the number of posterior samples in the given model instance 3 3 DETAILED DESCRIPTION OF COMMANDS 77 For each l mlike calculates the sample mean Z and numerical standard errors 7 74 from z4 z4 and A1 Ax in the same way that expect calculates 79 7K from 21 2mM a vector of equal log weights and A1 Ax Then for all l the estimate of the log marginal likelihood is given by pa log 2 and for all l and k the estimate of the numerical standard error for the log marginal likelihood is given by When numerical standard error is small results are not sensitive to the choice of p In these cases L 1 and p 0 5 will suffice However the additional compu tational burden of increasing L is negligible If you are conc
60. ting the following density to the region for which y is stationary DED N Fz Pa Pim 1d Di Ag 5 Aim Pr s jls 1 2 Pij The unknown quantity f gives for each observation time t the state probabilities at t given previous states previous values of the observed variables and the other unknown quantities It is not a primitive unknown quantity and it is included to give the user access to filtered probabilities 56 CHAPTER 2 MODELS 2 22 6 Creating a Model Instance The mnemonic label identifying the model is Hamilton Supply the names you wish to give the unknown quantities in the same order as they appear in the table of unknown quantities Supply the known quantities in the same order as they appear in the table of known quantities 2 22 7 Sampling Algorithm The sampling algorithm for prior simulation features five blocks Four blocks make indepen dent draws from the prior distributions of y h and P The fifth makes draws from the distribution s P The sampling algorithm for posterior simulation features five blocks each making draws from the conditional posterior distribution of one of the unknown quantities Chapter 3 BACC Commands 3 1 Overview of BACC Commands The following is a list of BACC commands with brief descriptions dirichletSim expecti expectN extract gammaSim gaussianSim listModelSpecs listModels miDelete miLoad miLoadAscii miSave miSaveAscii minst Ge
61. tion of 7 and an m x m matrix a indexing the prior distribution of P Data There are state observations sj 1 m for each individual i and each observation time t 11 SIN S STi STN 2 5 4 Data Generating Process The N observation sequences s 7_ are i i d with each sequence being first order Markov The initial distribution is 7 and the Markov transition matrix is P Pr si 8 Ts s 1 m Pie ass see Pos 2 5 5 Priors The m rows P of P and Tr are mutually independent and have the following marginal distributions T Di Qp Ps Ps1 Psm Di a s 1 m ao 201 ee aom 2 5 THE NON STATIONARY FIRST ORDER MARKOV FINITE STATE MODEL 21 a ay wee Q s 2 5 6 Creating a Model Instance The mnemonic label identifying the model is nsfomfs Supply the names you wish to give the unknown quantities in the following order first the name of 7m pi for example and then the name of P Supply the known quantities in the following order ag a S 2 5 7 Sampling Algorithms Generating Prior Samples Samples from the prior distributions of 7 and P are generated independently Generating Posterior Samples In the posterior distribution 7 P S the parameters 7 and P are conditionally independent and their marginal posterior distributions are the following familiar distributions S Di o Ps S Di s s 1 m where a aq n Ts ds Tarn no no
62. ts all available model specifications e g nlm poisson Usage listModelSpecs Inputs None Outputs None See Also minst listModels Example listModelSpecs Details A printed message gives a list of model specifications 3 3 DETAILED DESCRIPTION OF COMMANDS 3 3 8 The listModels Command Description Lists all open model instances Usage listModels Inputs None Outputs None See Also minst miDelete listModelSpecs Example listModels Details A printed message gives the model instance identification number the name of the model specification e g nlm poisson and the number of prior posterior and posterior HM draws 70 CHAPTER 3 BACC COMMANDS 3 3 9 The miDelete Command Description Closes without saving a or all model instances Usage miDelete modellInst Inputs model Inst Integer model instance identifier Outputs None See Also minst listModels Example miDelete mi 3 3 DETAILED DESCRIPTION OF COMMANDS 3 3 10 The miLoad Command Description Loads a model instance stored in a binary file Usage modelInst lt miLoad filename Inputs filename String name of binary file storing the model instance Outputs model Inst Integer model instance identifier See Also miSave minst miLoadAscii Example mi lt miLoad miFile 71 72 CHAPTER 3 BACC COMMANDS 3 3 11 The miLoadAscii Com
63. ts may contain data objects with differ ent data types or modes 1 Create a list Create a list with components x1 x2 numeric vectors y character vector and z1 matrix mylist lt list x1 x2 y z1 2 Attributes of a list length The number of components in the list length mylist Returns 4 mode The mode of a list is alway list names The names of the components Check names of the components in the list mylist names mylist Returns a vector with elements xi x2 y zi 3 To access list components a To access list components by name Show the value of component zi of mylist mnylist z1 Show the dimensions of compoonent z1 of mylist dim mylist z1 b To access list components by index Indexes must be enclosed in double barckets 31 Display the value of component z1 of mylist mylist 4 Bibliography DeRobertis L and J A Hartigan 1981 Bayesian Inference Using Intervals of Mea sures The Annals of Statistics 9 235 244 Gelfand A E and D K Dey 1994 Bayesian Model Choice Asymptotics and Exact Calculations Journal of the Royal Statistical Society Series B 56 501 514 Geweke J 1989 Bayesian Inference in Econometric Models Using Monte Carlo In tegration Econometrica 57 1317 1340 Geweke J 1992 Evaluating the Accuracy of Sampling Based Approaches to the Cal culation of Posterior Moments in J O Berger J M Ber
64. ulation matrix of a given model instance Generates or appends to the posterior HM simulation matrix of a given model instance Calculates upper and lower bounds on the mean of a posterior function of interest as the prior distribution is varied from its original specification Filters out previously generated draws from the prior simulation matrix of a given model instance Generates or appends to the prior simulation matrix of a given model instance Sets the seeds of the random number generators to a constant value Sets the seeds of the random number generators to the number of seconds since the beginning of 1970 Estimates a univariate density function for a weighted random sample using a kernel smoothing algorithm adapted to weighted samples Generates a sample from a Wishart distribution 3 2 Matlab Issues Help is available within Matlab for BACC commands Type help commandName at the Matlab prompt or help BACC for a list of BACC commands 3 3 Detailed Description of Commands Each BACC command is described in detail in one of the following sections 3 3 DETAILED DESCRIPTION OF COMMANDS 59 3 3 1 The dirichletSim Command Description Generates a sample from a multiple Dirichlet distribution Usage sample lt dirichletSim A n Inputs A m by K matrix Dirichlet parameters n Integer number of draws to generate Outputs sample n by nK matrix sample generated from multiple Dirichlet dis tribution Se
65. ution N 8 Hs p B 21 E P H 11 exp 8 BY H4 8 8 2 The precision parameter h has a scaled chi squared distribution with s h v p h 272PT 1 2 52124202 exp s h 2 2 9 A UNIVARIATE LINEAR MODEL WITH NORMAL DISTURBANCES 29 Sampling Algorithm See Example 3 4 1 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 30 CHAPTER 2 MODELS 2 10 The Dichotomous Choice Model with normally distributed disturbances 2 10 1 Dimension parameters There are k covariate coefficients and T observations of each variable 2 10 2 Unknown Quantities Unknown Parameters There is a k x 1 coefficient parameter 3 a scalar precision parameter h and a T x 1 vector y of latent outcomes 2 10 3 Known Quantities Prior Parameters There is a k x 1 coefficient mean vector 3 a k x k positive definite coefficient matrix Hg a precision degrees of freedom parameter v and a positive definite precision inverse scale parameter S Data There is a T x 1 vector of observations of dependent variables y taking values in 0 1 There is a T x k matrix X of observations of ancillary with respect to unknown quan tities variables 2 10 4 Data Generating Process See Sections 4 5 and 4 8 in Contemporary Bayesian Econometrics and Statistics by John Geweke at http www cirano qc ca bacc bacc2003 resources html 2 10 5 Priors S
66. vidual of N individuals and each observation period t of T periods S 2 4 4 Data Generating Process Each observation s is independently and identically distributed as follows Pr si 8 Ts s Lom 2 4 5 Priors m Di a 2 4 6 Creating a Model Instance The mnemonic label identifying the model is iidfs Supply the name you wish to give the unknown quantity m pi for example Supply the known quantities in the following order a S 2 4 7 Sampling Algorithms Generating Prior Samples Samples from the prior distribution of 7 are generated independently 2 4 THE LID FINITE STATE MODEL 19 Generating Posterior Samples In this model the posterior distribution for 7 is the following familiar distribution T S Di a where a arn n ni Nnm and ns is the number of observations for which s4 s Posterior samples are drawn independently from this distribution 2 4 8 Marginal Likelihood The marginal likelihood is given by NODHA Q Tins P a PCS Te Tay IO a 20 CHAPTER 2 MODELS 2 5 The Non Stationary First Order Markov Finite State Model 2 5 1 Dimension parameters There are m states N individuals and T observation times 2 5 2 Unknown Quantities Unknown Parameters There is a 1 x m initial state probability vector 7 and an m x m Markov transition probability matrix P 2 5 3 Known Quantities Prior Parameters The prior parameters are a 1 x m vector a indexing the prior distribu
67. xpectN These variables must be preloaded mlist lt list lw beta1 lw betap1 expN lt expectN mlist Again it is sufficient to use expN to get the components mean nse p of expN Find the minimum and maximum values of the posterior mean of betal as the prior is changed from its original specification robust out lt priorRobust lw beta1 The components of robust out would be mean std exactUP exactDown DeRHUp and DeRHDown Generate x y paris tracing an estimated posterior marginal density of betal smooth out lt weightedSmooth 1w betal plot the estimated posterior marginal density of betal plot smooth out Or equivalently plot smooth out y smooth out x Save the current model instance in the test file baccSim under the current working directory miSaveAscii modellInst baccSim 94 CHAPTER 4 A BACC TUTORIAL 4 2 Simulating from various distributions 1 Dirichlet a lt matrix 1 6 2 3 byrow T sample lt dirichletSim a 1000 cat dirichlet mean n mean sample n Gamma sample lt gammaSim 3 5 1000 cat gamma mean n mean sample n Gaussian Multivariate Normal mean lt c 1 2 precision lt matrix c 1 0 0 1 2 2 sample lt gaussianSim mean precision 1000 cat gaussian mean n apply sample 2 mean Pareto sample lt paretoSim 3 5 1000 cat pareto mean n mean sample n Wishart scale lt matrix c 1 0 0 1 2 2 sample lt wishartSim s
68. z taper Details Let z 21 2mM be the sample and log w1 log was be the vector of log weights Let A A1 Ax be the vector of halfwidths The sample is broken into T groups of size J MdivT and the last M mod T elements are ignored Thus Muse JT elements are used 3 3 DETAILED DESCRIPTION OF COMMANDS 61 The sample mean and standard deviation are calculated as follows Muse Muse ZS Wmm gt Wm m 1 m 1 Mause Mause 3 O bs Wal Zim Z Se un m merl 1 For the calculation of the first numerical standard error 79 we assume no serial correlation in z1 2 This is appropriate for independence or importance sampling Following Geweke 1989 3 this leads to Muse Muse 2 rams Y vaina an m 1 m 1 For the calculation of 7 through Tx the remaining K estimates of the nu merical standard error the following method is used First expect1 calculates group and sample means of the numerator quantity Wmzm and the denominator quantity Wm 1 tJ r 1 tJ z n t o Wmm t J Mo Wm t Sa 1 Muse Muse n M 5 Wm2m d M gt Wm use S Wee Then it calculates the following sample autocorellation and autcovariance func tions 1 T nlt 5 Y n s a n s t n t 0 T 1 s t 1 iS E yaalt 5 Y d s A d s t d t 0 T 1 s t 1 ae z malt 5 Y n s 7ds t d t 0 T 1 s t 1 e us 62 CHAPTER 3 BACC COMMANDS ky Tay and Ona n of Then it calculates for ea
Download Pdf Manuals
Related Search
Related Contents
Manual de Operación 血 _ ~ Triaー set MANUAL DE INSTRUCCIONES Tacómetro Estroboscopio Digital 4. Array course control カタログ - 2015 ARP Catalog Samsung C3200 Instrukcja obsługi HP Mini 210-1010NR Cooper Lighting IMI-179 User's Manual 取扱説明 - クボタ Copyright © All rights reserved.
Failed to retrieve file