7.2 Seemingly Unrelated Regression
In seemingly unrelated regression (SUR) models, there are M dependent variables, each with potentially different regressors, such that the stochastic errors are contemporaneously correlated. The model is given by:
\boldsymbol{y}_m = \boldsymbol{X}_m \boldsymbol{\beta}_m + \boldsymbol{\mu}_m,
where \boldsymbol{y}_m is an N-dimensional vector of observations, \boldsymbol{X}_m is an N \times K_m matrix of regressors, \boldsymbol{\beta}_m is a K_m-dimensional vector of location parameters, and \boldsymbol{\mu}_m is an N-dimensional vector of stochastic errors, for m = 1, 2, \dots, M.
Let \boldsymbol{\mu}_i = \left[\mu_{i1} \ \mu_{i2} \ \dots \ \mu_{iM}\right]^{\top}, where \boldsymbol{\mu}_i \sim \mathcal{N}(\boldsymbol{0}, \boldsymbol{\Sigma}). Stacking the M equations, we can write the model as:
\boldsymbol{y} = \boldsymbol{X} \boldsymbol{\beta} + \boldsymbol{\mu},
where \boldsymbol{y} = \left[\boldsymbol{y}_1^{\top} \ \boldsymbol{y}_2^{\top} \ \dots \ \boldsymbol{y}_M^{\top}\right]^{\top} is an MN-dimensional vector, \boldsymbol{\beta} = \left[\boldsymbol{\beta}_1^{\top} \ \boldsymbol{\beta}_2^{\top} \ \dots \ \boldsymbol{\beta}_M^{\top}\right]^{\top} is a K-dimensional vector with K = \sum_{m=1}^M K_m, and \boldsymbol{X} is an MN \times K block-diagonal matrix composed of the individual \boldsymbol{X}_m, i.e.,
\boldsymbol{X} = \begin{bmatrix} \boldsymbol{X}_1 & \boldsymbol{0} & \dots & \boldsymbol{0} \\ \boldsymbol{0} & \boldsymbol{X}_2 & \dots & \boldsymbol{0} \\ \vdots & \vdots & \ddots & \vdots \\ \boldsymbol{0} & \boldsymbol{0} & \dots & \boldsymbol{X}_M \end{bmatrix}.
Similarly, the vector of errors is given by \boldsymbol{\mu} = \left[\boldsymbol{\mu}_1^{\top} \ \boldsymbol{\mu}_2^{\top} \ \dots \ \boldsymbol{\mu}_M^{\top}\right]^{\top}, which is an MN-dimensional vector of stochastic errors, with \boldsymbol{\mu} \sim \mathcal{N}(\boldsymbol{0}, \boldsymbol{\Sigma} \otimes \boldsymbol{I}_N).
The likelihood function for the parameters is then:
p(\boldsymbol{\beta}, \boldsymbol{\Sigma} \mid \boldsymbol{y}, \boldsymbol{X}) \propto |\boldsymbol{\Sigma}|^{-N/2} \exp\left\{ -\frac{1}{2} (\boldsymbol{y} - \boldsymbol{X} \boldsymbol{\beta})^{\top} (\boldsymbol{\Sigma}^{-1} \otimes \boldsymbol{I}_N) (\boldsymbol{y} - \boldsymbol{X} \boldsymbol{\beta}) \right\}.
Using independent priors \pi(\boldsymbol{\beta}) \sim \mathcal{N}(\boldsymbol{\beta}_0, \boldsymbol{B}_0) and \pi(\boldsymbol{\Sigma}^{-1}) \sim W(\alpha_0, \boldsymbol{\Psi}_0), the posterior distributions are
\boldsymbol{\beta} \mid \boldsymbol{\Sigma}, \boldsymbol{y}, \boldsymbol{X} \sim \mathcal{N}(\boldsymbol{\beta}_n, \boldsymbol{B}_n),
\boldsymbol{\Sigma}^{-1} \mid \boldsymbol{\beta}, \boldsymbol{y}, \boldsymbol{X} \sim W(\alpha_n, \boldsymbol{\Psi}_n),
where \boldsymbol{B}_n = (\boldsymbol{X}^{\top} (\boldsymbol{\Sigma}^{-1} \otimes \boldsymbol{I}_N) \boldsymbol{X} + \boldsymbol{B}_0^{-1})^{-1}, \boldsymbol{\beta}_n = \boldsymbol{B}_n (\boldsymbol{B}_0^{-1} \boldsymbol{\beta}_0 + \boldsymbol{X}^{\top} (\boldsymbol{\Sigma}^{-1} \otimes \boldsymbol{I}_N) \boldsymbol{y}), \alpha_n = \alpha_0 + N and \boldsymbol{\Psi}_n = (\boldsymbol{\Psi}_0^{-1} + \boldsymbol{U}^{\top} \boldsymbol{U})^{-1}, where \boldsymbol{U} is an N \times M matrix whose columns are \boldsymbol{y}_m - \boldsymbol{X}_m \boldsymbol{\beta}_m.
We can demonstrate, through straightforward yet tedious algebra, that by defining \boldsymbol{y}_i = [y_{i1} \ y_{i2} \ \dots \ y_{iM}] and
\boldsymbol{X}_i = \begin{bmatrix} x_{1i}^{\top} & \boldsymbol{0} & \dots & \boldsymbol{0} \\ \boldsymbol{0} & x_{2i}^{\top} & \dots & \boldsymbol{0} \\ \vdots & \vdots & \ddots & \vdots \\ \boldsymbol{0} & \boldsymbol{0} & \dots & x_{Mi}^{\top} \end{bmatrix},
we alternatively have \boldsymbol{B}_n = (\boldsymbol{B}_0^{-1} + \sum_{i=1}^N \boldsymbol{X}_i^{\top} \boldsymbol{\Sigma}^{-1} \boldsymbol{X}_i)^{-1}, \boldsymbol{\beta}_n = \boldsymbol{B}_n (\boldsymbol{B}_0^{-1} \boldsymbol{\beta}_0 + \sum_{i=1}^N \boldsymbol{X}_i^{\top} \boldsymbol{\Sigma}^{-1} \boldsymbol{y}_i) and \boldsymbol{\Psi}_n = (\boldsymbol{\Psi}_0^{-1} + \sum_{i=1}^N (\boldsymbol{y}_i - \boldsymbol{X}_i^{\top} \boldsymbol{\beta}) (\boldsymbol{y}_i - \boldsymbol{X}_i^{\top} \boldsymbol{\beta})^{\top})^{-1}.
Observe that we have standard conditional posteriors, thus, we can employ a Gibbs sampling algorithm to get the posterior draws.
Example: Utility demand
Let’s use the dataset Utilities.csv to estimate a seemingly unrelated regression (SUR) model for utilities. We adopt the same setting as in Exercise 14 of Chapter 3, where we estimate a multivariate regression model while omitting households with no consumption in any utility. In this exercise, we observe that not all regressors are relevant for the demand of electricity, water, and gas. Thus, we estimate the following model:
\begin{align*} \log(\text{electricity}_i) & = \beta_1 + \beta_2\log(\text{electricity price}_i) + \beta_3\log(\text{water price}_i) \\ & + \beta_4\log(\text{gas price}_i) + \beta_5\text{IndSocio1}_i + \beta_6\text{IndSocio2}_i + \beta_7\text{Altitude}_i \\ & + \beta_8\text{Nrooms}_i + \beta_9\text{HouseholdMem}_i + \beta_{10}\log(\text{Income}_i) + \mu_{i1} \\ \log(\text{water}_i) & = \alpha_1 + \alpha_2\log(\text{electricity price}_i) + \alpha_3\log(\text{water price}_i) \\ & + \alpha_4\log(\text{gas price}_i) + \alpha_5\text{IndSocio1}_i + \alpha_6\text{IndSocio2}_i \\ & + \alpha_7\text{Nrooms}_i + \alpha_8\text{HouseholdMem}_i + \mu_{i2} \\ \log(\text{gas}_i) & = \gamma_1 + \gamma_2\log(\text{electricity price}_i) + \gamma_3\log(\text{water price}_i) \\ & + \gamma_4\log(\text{gas price}_i) + \gamma_5\text{IndSocio1}_i + \gamma_6\text{IndSocio2}_i + \gamma_7\text{Altitude}_i \\ & + \gamma_8\text{Nrooms}_i + \gamma_9\text{HouseholdMem}_i + \mu_{i3}, \end{align*}
where electricity, water, and gas represent the monthly consumption of electricity (kWh), water (m^3), and gas (m^3) of Colombian households. The dataset includes information on 2,103 households, with details on the average prices of electricity (USD/kWh), water (USD/m^3), and gas (USD/m^3), as well as indicators of the socioeconomic conditions of the neighborhood where the household is located (IndSocio1 being the lowest and IndSocio3 the highest). Additionally, there is information on whether the household is located in a municipality situated at over 1,000 meters above sea level, the number of rooms in the house, the number of household members, and monthly income (USD).
Since each equation has a different set of regressors, and we suspect correlation between the stochastic errors of the three equations, we should estimate a seemingly unrelated regression (SUR) model. We expect unobserved correlation across these equations because we are modeling utilities, and in some cases, a single provider handles all three services and issues one bill.
The following Algorithm demonstrates how to estimate SUR models using our GUI. Our GUI utilizes the command rsurGibbs from the bayesm package in R software. See Chapter 5 for further details, including instructions on how to set up the dataset, and check the templates available in our GitHub repository (https://github.com/besmarter/BSTApp) in the DataApp and DataSim folders.
Algorithm: Seemingly Unrelated Regression (SUR)
Select Multivariate Models on the top panel
Select Seemingly Unrelated Regression model using the left radio button
Upload the dataset, selecting first if there is a header in the file, and the kind of separator in the csv file of the dataset (comma, semicolon, or tab). Then, use the Browse button under the Choose File legend
Select MCMC iterations, burn-in, and thinning parameters using the Range sliders
Select the number of dependent variables in the box Number of endogenous variables: m
Select the number of independent variables in the box TOTAL number of Exogenous Variables: k. This is the sum of all exogenous variables over all equations, including intercepts. In the example of Utility demand, it is equal to 27
Set the hyperparameters: mean vectors, covariance matrix, degrees of freedom, and the scale matrix. This step is not necessary as by default our GUI uses non-informative priors
Click the Go! button
Analyze results
Download posterior chains and diagnostic plots using the Download Posterior Chains and Download Posterior Graphs buttons
The following code shows how to program this application using this package. We use 10,000 MCMC iterations, \boldsymbol{\beta}_0 = \boldsymbol{0}_{27}, \boldsymbol{B}_0 = 100\boldsymbol{I}_{27}, \alpha_0 = 5 and \boldsymbol{\Psi} = 5\boldsymbol{I}_3.
We find that the posterior median estimates of the own-price elasticities of demand for electricity, water, and gas are -1.88, -0.36, and -0.62, respectively, and none of the 95% credible intervals encompass 0. This means that a 1% increase in the prices of electricity, water, and gas results in a 1.88%, 0.36%, and 0.62% decrease in the monthly consumption of these utilities, respectively.41 In general, there is evidence supporting the relevance of all regressors in these equations, with a few exceptions, and unobserved correlation in the demand for these services, which further supports the use of a SUR model in this application.
rm(list = ls())
set.seed(010101)
library(dplyr)
DataUt <- read.csv("https://raw.githubusercontent.com/besmarter/BSTApp/refs/heads/master/DataApp/Utilities.csv", sep = ",", header = TRUE, quote = "")
DataUtEst <- DataUt %>%
filter(Electricity != 0 & Water !=0 & Gas != 0)
attach(DataUtEst)
## The following object is masked from Data (pos = 7):
##
## id
## The following object is masked from mydata:
##
## id
## The following objects are masked from DataUtEst (pos = 13):
##
## Altitude, Children, Electricity, Gas, HouseholdMem, id, IndSocio1,
## IndSocio2, IndSocio3, Lnincome, LnPriceElect, LnPriceGas,
## LnPriceWater, Nrooms, Water
y1 <- log(Electricity); y2 <- log(Water); y3 <- log(Gas)
X1 <- cbind(1, LnPriceElect, LnPriceWater, LnPriceGas, IndSocio1, IndSocio2, Altitude, Nrooms, HouseholdMem, Lnincome)
X2 <- cbind(1, LnPriceElect, LnPriceWater, LnPriceGas, IndSocio1, IndSocio2, Nrooms, HouseholdMem)
X3 <- cbind(1, LnPriceElect, LnPriceWater, LnPriceGas, IndSocio1, IndSocio2, Altitude, Nrooms, HouseholdMem)
regdata <- NULL
regdata[[1]] <- list(y = y1, X = X1); regdata[[2]] <- list(y = y2, X = X2); regdata[[3]] <- list(y = y3, X = X3)
M <- length(regdata); K1 <- dim(X1)[2]; K2 <- dim(X2)[2]; K3 <- dim(X3)[2]
K <- K1 + K2 + K3
# Hyperparameters
b0 <- rep(0, K); c0 <- 100; B0 <- c0*diag(K); V <- 5*diag(M); a0 <- M
Prior <- list(betabar = b0, A = solve(B0), nu = a0, V = V)
#Posterior draws
S <- 10000; keep <- 1; Mcmc <- list(R = S, keep = keep, nprint = 0)
PosteriorDraws <- bayesm::rsurGibbs(Data = list(regdata = regdata), Mcmc = Mcmc, Prior = Prior)
##
## Starting Gibbs Sampler for SUR Regression Model
## with 3 regressions
## and 1574 observations for each regression
##
## Prior Parms:
## betabar
## [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## A
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
## [1,] 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [2,] 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [3,] 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [4,] 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [5,] 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [6,] 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [7,] 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00
## [8,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00
## [9,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00
## [10,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00
## [11,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00
## [12,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00
## [13,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01
## [14,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [15,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [16,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [17,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [18,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [19,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [20,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [21,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [22,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [23,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [24,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [25,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [26,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [27,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
## [1,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [2,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [3,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [4,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [5,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [6,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [7,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [8,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [9,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [10,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [11,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [12,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [13,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [14,] 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [15,] 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [16,] 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [17,] 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [18,] 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [19,] 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 0.00
## [20,] 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00
## [21,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00
## [22,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00
## [23,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00
## [24,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00
## [25,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01
## [26,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [27,] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
## [,26] [,27]
## [1,] 0.00 0.00
## [2,] 0.00 0.00
## [3,] 0.00 0.00
## [4,] 0.00 0.00
## [5,] 0.00 0.00
## [6,] 0.00 0.00
## [7,] 0.00 0.00
## [8,] 0.00 0.00
## [9,] 0.00 0.00
## [10,] 0.00 0.00
## [11,] 0.00 0.00
## [12,] 0.00 0.00
## [13,] 0.00 0.00
## [14,] 0.00 0.00
## [15,] 0.00 0.00
## [16,] 0.00 0.00
## [17,] 0.00 0.00
## [18,] 0.00 0.00
## [19,] 0.00 0.00
## [20,] 0.00 0.00
## [21,] 0.00 0.00
## [22,] 0.00 0.00
## [23,] 0.00 0.00
## [24,] 0.00 0.00
## [25,] 0.00 0.00
## [26,] 0.01 0.00
## [27,] 0.00 0.01
## nu = 3
## V =
## [,1] [,2] [,3]
## [1,] 5 0 0
## [2,] 0 5 0
## [3,] 0 0 5
##
## MCMC parms:
## R= 10000 keep= 1 nprint= 0
##
Bs <- PosteriorDraws[["betadraw"]]
Names <- c("Const", "LnPriceElect", "LnPriceWater", "LnPriceGas", "IndSocio1", "IndSocio2",
"Altitude", "Nrooms", "HouseholdMem", "Lnincome", "Const",
"LnPriceElect", "LnPriceWater", "LnPriceGas", "IndSocio1", "IndSocio2",
"Nrooms", "HouseholdMem","Const",
"LnPriceElect", "LnPriceWater", "LnPriceGas", "IndSocio1", "IndSocio2",
"Altitude", "Nrooms", "HouseholdMem")
colnames(Bs) <- Names
summary(coda::mcmc(Bs))
##
## Iterations = 1:10000
## Thinning interval = 1
## Number of chains = 1
## Sample size per chain = 10000
##
## 1. Empirical mean and standard deviation for each variable,
## plus standard error of the mean:
##
## Mean SD Naive SE Time-series SE
## Const 1.343420 0.45854 0.0045854 0.0045854
## LnPriceElect -1.883221 0.26486 0.0026486 0.0026100
## LnPriceWater -0.356765 0.04423 0.0004423 0.0004423
## LnPriceGas -0.098387 0.05960 0.0005960 0.0006046
## IndSocio1 -0.737529 0.07192 0.0007192 0.0006969
## IndSocio2 -0.151118 0.04787 0.0004787 0.0004859
## Altitude -0.220988 0.02531 0.0002531 0.0002531
## Nrooms 0.070102 0.01236 0.0001236 0.0001236
## HouseholdMem 0.086989 0.01057 0.0001057 0.0001057
## Lnincome 0.062892 0.01244 0.0001244 0.0001223
## Const 2.177612 0.65917 0.0065917 0.0065917
## LnPriceElect -0.050723 0.39241 0.0039241 0.0039241
## LnPriceWater -0.364801 0.06656 0.0006656 0.0006656
## LnPriceGas 0.226759 0.08681 0.0008681 0.0008681
## IndSocio1 -0.427636 0.11136 0.0011136 0.0011334
## IndSocio2 -0.359542 0.07427 0.0007427 0.0007427
## Nrooms 0.093014 0.01868 0.0001868 0.0001868
## HouseholdMem 0.131650 0.01612 0.0001612 0.0001612
## Const -1.215735 0.54177 0.0054177 0.0054177
## LnPriceElect -1.794509 0.31960 0.0031960 0.0031960
## LnPriceWater -0.003921 0.05257 0.0005257 0.0005257
## LnPriceGas -0.625445 0.07270 0.0007270 0.0007270
## IndSocio1 -0.744103 0.08706 0.0008706 0.0008706
## IndSocio2 -0.203635 0.05893 0.0005893 0.0005893
## Altitude 0.311631 0.03136 0.0003136 0.0003136
## Nrooms 0.089361 0.01481 0.0001481 0.0001488
## HouseholdMem 0.169882 0.01264 0.0001264 0.0001264
##
## 2. Quantiles for each variable:
##
## 2.5% 25% 50% 75% 97.5%
## Const 0.44452 1.03120 1.342407 1.65192 2.25376
## LnPriceElect -2.39679 -2.06328 -1.882706 -1.70369 -1.36996
## LnPriceWater -0.44221 -0.38678 -0.356850 -0.32669 -0.26969
## LnPriceGas -0.21655 -0.13777 -0.098191 -0.05902 0.01872
## IndSocio1 -0.87630 -0.78653 -0.737701 -0.68840 -0.59675
## IndSocio2 -0.24601 -0.18286 -0.151440 -0.11896 -0.05681
## Altitude -0.27080 -0.23838 -0.220742 -0.20385 -0.17259
## Nrooms 0.04596 0.06178 0.070023 0.07835 0.09422
## HouseholdMem 0.06600 0.07994 0.086857 0.09411 0.10785
## Lnincome 0.03836 0.05421 0.062957 0.07165 0.08717
## Const 0.88957 1.73496 2.169638 2.62170 3.47216
## LnPriceElect -0.81956 -0.31624 -0.054075 0.21132 0.71842
## LnPriceWater -0.49559 -0.40995 -0.364248 -0.32026 -0.23639
## LnPriceGas 0.06075 0.16754 0.226690 0.28570 0.39476
## IndSocio1 -0.64203 -0.50302 -0.427819 -0.35226 -0.21315
## IndSocio2 -0.50401 -0.40949 -0.359821 -0.31063 -0.21199
## Nrooms 0.05688 0.08023 0.093139 0.10555 0.12968
## HouseholdMem 0.10041 0.12065 0.131506 0.14260 0.16314
## Const -2.28569 -1.58566 -1.220078 -0.84612 -0.14787
## LnPriceElect -2.42484 -2.01228 -1.797269 -1.57889 -1.16396
## LnPriceWater -0.10684 -0.03923 -0.004088 0.03153 0.09905
## LnPriceGas -0.76526 -0.67445 -0.625899 -0.57734 -0.48125
## IndSocio1 -0.91381 -0.80243 -0.744909 -0.68577 -0.57341
## IndSocio2 -0.31791 -0.24388 -0.203300 -0.16415 -0.09012
## Altitude 0.24896 0.29099 0.311668 0.33256 0.37278
## Nrooms 0.06050 0.07921 0.089386 0.09943 0.11793
## HouseholdMem 0.14467 0.16144 0.170024 0.17843 0.19431
## Posterior Means of Std Deviations and Correlation Matrix
## Std Dev 1 2 3
## 1 0.46 1.00 0.30 0.25
## 2 0.72 0.30 1.00 0.23
## 3 0.56 0.25 0.23 1.00
##
## Upper Triangle of Var-Cov Matrix
## Summary of Posterior Marginal Distributions
## Moments
## mean std dev num se rel eff sam size
## 1,1 0.214 0.0077 7.1e-05 0.78 9000
## 1,2 0.099 0.0087 9.2e-05 1.01 4500
## 2,2 0.512 0.0182 1.9e-04 0.95 9000
## 1,3 0.064 0.0068 6.6e-05 0.84 9000
## 2,3 0.094 0.0105 1.1e-04 1.02 4500
## 3,3 0.317 0.0114 1.2e-04 0.94 9000
## based on 9000 valid draws (burn-in=1000)
We ask in the Exercise 5 to run this application using our GUI and the information in the dataset Utilities.csv. Observe that this file should be modified to agree the structure that requires our GUI (see the dataset 5Institutions.csv in the folder DataApp of our GitHub repository -https://github.com/besmarter/BSTApp- for a template). In addition, we ask to program from scratch the Gibbs sampler algorithm in this application.
References
This is an example where concerns about biased and inconsistent posterior mean estimates may arise, for instance, due to reverse causality between quantity and demand. These concerns are valid; however, we are using micro-level data, which implies no demand-supply simultaneity. Additionally, the utility providers operate in regulated natural monopoly markets, which mitigates endogeneity from searching provider strategies. Finally, we took prices directly from provider records, which avoids potential price measurement errors Ramı́rez–Hassan and López-Vera (2024).↩︎