(*********************************************************************************)
(* Estimation of a System of National Accounts (SNA)                             *)
(* Mathematica Code by Tugrul Temel, 28 October 2008, Tilburg                    *)
(**********************************************************************************)

CellPrint[Cell["Bayesian Estimation of System of National Accounts","Section", Background->GrayLevel[.7]]]  ;  (* The title of the estimations *)
decimalRule=x_Real:>N[Round[100 x]/100] ;              (* Rounding all real numbers to two-digit numbers *)
SetOptions["stdout",PageWidth->79] ;                         (* Setting page width  *)

(*********************************************************************************)
(* Import Data from Excel to Mathematica                                         *)
(*********************************************************************************)

SetDirectory["D:\\TTemel\\TILBURG\\Projects\\Bhutan"]  ;(* Setting the current directory where the data is placed *)

Clear[data1, data2, data3, data4, data5, data6, data7, data8, data9, data10, data11, X, n, benchmark, Nbm, Xbm, basicdata, p, data, ratios, m1, ratio, ratios1, otherpriors, m2, other, identities, m3, identity, stddata, stdratio, stdother, originalVarNames] ;

data1    =Import["SAM Bayesian estimations_Bhutan.xls", {"Data",1}] ;
data2    =Import["SAM Bayesian estimations_Bhutan.xls", {"Data",2}] ;
data3    =Import["SAM Bayesian estimations_Bhutan.xls", {"Data",3}] ;
data4    =Import["SAM Bayesian estimations_Bhutan.xls", {"Data",4}] ;
data5    =Import["SAM Bayesian estimations_Bhutan.xls", {"Data",5}] ;
data6    =Import["SAM Bayesian estimations_Bhutan.xls", {"Data",6}] ;
data7    =Import["SAM Bayesian estimations_Bhutan.xls", {"Data",7}] ;
data8    =Import["SAM Bayesian estimations_Bhutan.xls", {"Data",8}] ;
data9    =Import["SAM Bayesian estimations_Bhutan.xls", {"Data",9}] ;
data10 =Import["SAM Bayesian estimations_Bhutan.xls", {"Data",10}] ;
data11 =Import["SAM Bayesian estimations_Bhutan.xls", {"Data",11}] ;

SetDirectory["D:\\TTemel\\TILBURG\\Projects\\Mathematica SNA Compilation\\Bayesian Estimations\\My Applications"]  ;(* Setting the current directory where "BayesianEstimation.m" is placed *)

Get["BayesianEstimation`"]    ;    (* Recalling the following functions from the "BayesianEstimation.m" package into the current directory *) 
?BayesianEstimation                        (* Explainig the content of "BayesianEstimation.m"   *)

Bayesian Estimation of System of National Accounts

Step 1. Testing Rank Condition

Step 2. A System of Linearly Independent Equations

Step 3. Variance-Covariance Matrices

Bayesian Estimation