As a economist or a decision maker, we cannot avoid decision making, from whether expand the scale of a company to judge which firm is the most efficient one. The question is "is there any useful information for making these tough decisions?"

  • Efficiency
See my previous post here.
  • Scale
Whether a firm should expand its size or not usually depends on the possible cost induced by the further expansion. Consider a firm producing only one type of product. If the its single-product cost function could be depicted as follows, it is encouraged to expand its size since the unit cost is decreasing with the level of output due the spreading  the fixed cost over a large number of units of a type of product.       

  • Scope
When a firm consider to produce one more type of output, economies of scope could be present if the total cost of joint production is less than the separate production.

this webpage perfectly explain the differences between economies of scale and scope.

  • Cost-effectiveness ratio

This index is wildly used in the filed of health economics to help decide whether certain treatment is effective and cheaper. See O'Hagan's work for the framework.

This article will continuously be updated and I welcome anyone of you to post your experience here.
If you agree on the statement that science is based on the previous evidence and that evidence could affect the researchers' thoughts toward the next researches, it is not surprising that every study will involve some subjective judgement while conducting the researches. This is not the terrible part. The worse part of the judgement is that this could affect the estimation implicitly. In other words, we did not consider this judgement during building the model. Bayes theorem is what we need to include all the possible information including researcher's judgement into the model and then use the data we collected to update the model. This theorem is powerful but not valued as a essential tool for researches especially in the field of social science. The massive usage of probability and mathematics could be the causes. In this post, I would like to introduce some references that are extremely useful for the stepping stone of learning Bayes theorem. You don't have to read every book in the section. Instead, I encourage you to find every book in each section and try to find one  that best fits you.  For a reading list for programming in Bayesian estimation, read my another post here.
  • Mathematics
  1. Calculus and its applications
  2. Fundamental Methods of Mathematical Economics

  • Probability theory
  1. Introduction to probability (by Blitzstein) 
  2. Introduction to probability

  • Bayes' Theory 
Bayes' theory would be a game changer for statistical estimations. It is not just a method for estimations but also a philosophy which fits our common sense toward the estimation.  Sooner or latter, most statistics textbook could be revised because of statistical concepts from Bayes' theory. Other estimation could be just a special case of Bayes' theory and this makes Bayes' Theory demand more backgrounds of math and probability. Therefore, before I provide the book list of Bayes' theory. I have to warn you that you would not even survive the chapter one if you do not have any concepts of calculus and probability. Thus, you should read the references I mentioned above, and then you can have fun and feel the power of Bayes' Theory through the following books I suggest.
  1. Bayesian Analysis for the Social Sciences: (PPT of this book could be found in author's website) This book provides many useful plots to give you the most direct learning of Bayes' theory.  The author also offers clear proofs in the appendix. For readers who only want to realize the basics, you should at least read introduction and chapter one of this book. 
  2. Bayesian Ideas and Data Analysis: This book has the goodness of explanation of the reasons for using different priors. Best of all, it provides detailed Winbugs and R codes in their website. 
  3. Bayesian Econometrics: This book is very popular in the field of economics. I especially like that the author introduces the Bayes' theory by closely relating it to linear models which we are familiar with most. Since the author is one of the leading researcher in Bayesian efficiency estimation (see my another post), you will also benefit a lot from reading this book before you jump in that field. This author's another book,Bayesian Econometric Methods, is also worth reading. It also focus on the linear model but provides more detailed proofs and clearer math notation. Other short introduction of Bayesian methods in econometrics could be found in chapter 13, Microeconometrics Methods and Applications.    
  4. Bayesian Data Analysis: Very well-known and wildly used for an Bayesian analysis. The first two edition uses Winbugs for demonstrating their Bayesian results while the latest edition use Stan instead. This book is not appropriate for beginners but it provides wide topics. Therefore, you should consider it as a very good model source. The best of it, the math notation is very close to the first book I recommended, so you save lots time when you finish reading the first one.   
  5. Bayesian Inference: with ecological applications

This article will continuously be updated and I welcome anyone of you to post your experience here.
Efficiency estimation is to measure how efficient the decision making units are. The methodologies probably has been dominated by Stochastic frontier analysis (SFA, for parametric analysis) and Data envelopment analysis (for non-parametric analysis). For SFA, it is a branch of micro-economics and therefore you cannot avoid using some theories from micro-economics when measuring the efficiency. If you want to have relevant backgrounds regarding SFA, see my another post. In this article, I will try to recommend a reference list for efficiency estimation. This list will be appropriate for any researches regardless your research field.

Basic concepts
Performance Benchmarking_Measuring and Managing Performance
Introduction to Econometric Production Analysis with R
Benchmarking with DEA, SFA, and R

A Practitioner's Guide to Stochastic Frontier Analysis Using Stata

Data Envelopment Analysis: Modeling Operational Processes And Measuring Productivity 

This article will continuously be updated and I welcome anyone of you to post your experience here.
Yes, you can Google the key words to find the BUGS ( including WinBUGS and OpenBUGS) codes for your model but usually they will not work or you just can not understand what they are writing. You should firstly understand basic codes skill about BUGS:

1. Process for Building Bayesian Model
You could refer to the following picture.
Process for Building Bayesian Model 
see the example in the book,Applied Bayesian Statistics, pp.147

2. BUGS code structure
  "Data analysis using regression and multilevel/hierarchical models" (section 16.8, p.366)  gives excellent explanations about the BUGS code structure.  

3. How to perform the codes
"Bayesian Modeling Using WinBUGS" (chapter 3 and 4) gives clear pictures to teach you how to run your codes. 

4. Run BUGS through R
"Simple linear regression using R2OpenBUGS"
It is not easy to import your data in BUGS if your dataset is too big. Try to use R as a tool to manage data and deal with the MCMC results. This author offers a simple example (linear model) to teach you how to use these. If you want to totally include your BUGS code in R console, you should use sink and cat function , see this blog for a very vivid example. Other useful tricks for running BUGS within R could also found in book, Introduction to WinBUGS for Ecologists, (Appendix 1 - A List of WinBUGS Tricks).

5. Other special BUGS functions
Useful functions could be found here. More examples about using these should refer to The BUGS Book.

6. Bayes' Theory
I have gave a reading list for understanding this part in my another post. You should at least fully understand the first chapter of Bayesian Analysis for the Social Sciences.

Now you understand the basics, and you could try to search the codes about your interested models. The best and workable sources come from the books and journal articles.  Most authors below are very generous to provide the codes in their website. I will not provide these codes here but will suggest the references for you.

1. Efficiency estimation
(1)Stochastic frontier model
"Bayesian stochastic frontier analysis using WinBUGS"
The author (Professor Jim Griffin) provides the WinBUGS code in his website.
I depict their data structure as follows and you should also read their paper on page 165.

2. Panel data analysis
"Introduction to applied Bayesian statistics and estimation for social scientists" (ch.9)
Relevant theory of Bayesian panel data model could refer to Bayesian Econometrics (ch.7), Panel Data Modeling and Inference: A Bayesian PrimerIntroduction to Modern Bayesian Econometrics (ch.7)
For specific panel data analysis demonstration:

3. Multilevel/hierarchical models
"Data analysis using regression and multilevel/hierarchical models" especially chapter 17, p.305
"Applied Bayesian Hierarchical Methods"
"Scope economies in Australian distance education"

4. Econometrics
"An introduction to modern Bayesian Econometrics"

5. Rasch (IRT) Model
"Bayesian Estimation for the Rasch Model using WinBUGS"

6. Random Coefficient Dynamic Factor Models
"Bayesian Estimation of Random Coefficient Dynamic Factor Models"

7. Categorical models
Bayesian Models for Categorical Data, codes

8. Latent Growth Model
latent basis growth curve model with varying residual variances
latent basis growth curve model

9. Prediction
Linear regression: Bayesian Ideas and Data Analysis p. 241
Other models
"The BUGS Book"
"Bayesian modeling using WinBUGS"

This article will continuously be updated and I welcome anyone of you to post your experience here.

BUGS (including WinBUGS and OpenBUGS  is a powerful tool to do Bayesian estimation but it usually would not run without a fight (error messages). Most BUGS books focus on teaching you how to build a Bayesian model and run BUGS in your computer but few books teach you how to debug and find the solution to your problems. In this article, I try to bring common error message showing in BUGS and give possible solutions. This post will be divided into three parts: Check Model, Load Data, and Compile. These parts are the 3-step procedure when running BUGS. If you don't know these, I suggest you read the chapter 3 and 4 in the book "Bayesian Modeling Using WinBUGS". "Data analysis using regression and multilevel/hierarchical models" (section 16.8, p.366) also gives excellent explanations about the BUGS code structure.

1. Check Model

You need basic skill for BUGS language syntax and you could refer to Appendix in the book "The BUGS Book". 
  • "Error in is.finite(x)": 
If you run winbug within R using R2WinBugs or R2OpenBugs. Check the R code for your BUGS data if there is any elements which does not belong to the BUGS code. Another reason could be you put other data format in your BUGS data. Remember, BUGS data only accepts matrix format.
    • "unknown type of distribution"
    This simply means that BUGS cannot recognize the distribution you write. For WinBUGS users, you should check your spelling or update the distribution by following the instruction. For OpenBUGS users, some distribution (for example truncated normal could be used by following the procedure above), should be modified following this instruction.
    • "Unknown type of logical function"
    Remember, in BUGS, ~ means "is distributed as" and < - means "is to be replaced by" Therefore, this error message just warn you probably put < - in front of the distribution code.
    • "invalid or unexpected token scanned"
    These are the common mistakes will show in your BUGS because you did not add another half codes like } and ]. I suggest you use code editor  like RStudio since the BUGS use similar codes with R. The beauty of RStudio is that it will automatically help you add another half codes.

    2. Load Data

    One of the difficulties to use BUGS is that its data format is quite different from we usually use. I find it is hard to import your data especially when your data format is excel. If your data is not large, it will be ok just to copy and paste. If it is not, you better consider to use R (its package "R2WinBUGS and "R2OpenBUGS" to call BUGS to work for you.
    • "expected key word structure error pos 1534"
    Check whether there are matrix type (like data[i,j])of data in the Model code but you use vector type (like data[i]) in the Data (including the initial values) code. It's the same the other way round. You should make sure that model and data have a consistent type. See examples in stackoverflow.

    3. Compile

    "model is syntactically correct" Ya! After lot of works, you finally let BUGS compile the model and data and it starts to run! However, you still could get the error messages and BUGS just does not give any results.
    • logical expression contains too many constants
    This usually happens when you are doing the prediction using linear regression model. Example like this one [code] Tcost <- b0+b1*my1+b2*my2+b3*my3+b4*my4+b5*my5+b6*my6+b7*my7 #Total costs +0.5*b11*my1^2+0.5*b22*my2^2+0.5*b33*my3^2+0.5*b44*my4^2+0.5*b55*my5^2+0.5*b66*my6^2+0.5*b77*my7^2 +b12*my1*my2+b13*my1*my3+b14*my1*my4+b15*my1*my5+b16*my1*my6+b17*my1*my7+b23*my2*my3+b24*my2*my4+b25*my2*my5+b26*my2*my6+b27*my2*my7+b34*my3*my4+b35*my3*my5+b36*my3*my6+b37*my3*my7+b45*my4*my5+b46*my4*my6+b47*my4*my7+b56*my5*my6+b57*my5*my7+b67*my6*my7 +bp1*mw1+bp2*mw2)[/code] You try to predict the total cost using the cost function with WinBugs. When your predictors are not too many like this one, you can plug those value like the example. However, once the predictor is too many, you should use the function inprod( ) to solve this problem like the following code: [code]  Tcost <- inprod B[1:K], M[1,1:K]) #total costs[/code] where B is a vector of coefficients, M is a vector of mean, and P is the number of predictors.
    • Trap 66
    See example and solutiohere.
    • "number of items not equal to size of node error"
    Sometimes, even if this error shows up, BUGS will still give you the final results. You need to check whether a initial value vector is the same size as parameter vector in OpenBUGS.
    • "Sorry something went wrong in procedure Sqrt in module Math"
    Check whether the setup of your sigma for data dependent variable (y) is beyond the range of data y. For example, your data y is from 0~100, and you should set your sigma at least to 1000 (when it is uniform distribution). See examples in Bayesian Data Analysis (ed 2, p.5 93).
    • "Sorry something went wrong in procedure Writer.SetPos in module HostFiles"
    Honestly, I don't know what it mean, but I overcome this by reducing the number of iterations and burnin. However, it does not guarantee you will get the right results. In fact, sometimes you could get unstable estimated parameters especially when you lower down the number of iterations greatly. It's better to recheck your codes. You could see more debug techniques in the book, "Data analysis using regression and multilevel/hierarchical models" (chapter 19, p.415).
    • "Sorry something went wrong in procedure ..."
    This problem is more general and ... means any problems including the above problem. If you want to know more what is wrong in your BUGS, see this blog for further info. After you follow the procedure of above blog, you could see trap window writing the errors below instead of "Sorry something went wrong in procedure..."
    • "expected the collection operator c error pos"
    Check whether you do not give initial values to certain nodes. Make sure each node have their own initial values.
    • "undefined real result  Pre: argument of Sqrt must not be negative"
    Check whether your BUGS code variance for your data (y) is larger than your data (y). You should also check your priors. This problem also often occurs in a Hierarchical model especially when you assign a Gamma prior to the variance of your data. If you just want to use a informative prior and then you should just use a Uniform prior instead. However, if you want to use a Gamma distribution, and then try to increase the number within each group and reduce the number of variables. This article will continuously be updated and I welcome anyone of you to post your experience here.