Update coefficient vector of multiple linear regression
Update coefficient vector of multiple linear regression
This function updates the coefficient vector of a multiple linear regression.
update_reg(mu0, Tau0, XSigX, XSigU)
Arguments
mu0: The mean vector of the normal prior distribution for the coefficient vector.
Tau0: The precision matrix (i.e. inverted covariance matrix) of the normal prior distribution for the coefficient vector.
XSigX: The matrix ∑n=1NXn′Σ−1Xn. See below for details.
XSigU: The vector ∑n=1NXn′Σ−1Un. See below for details.
Returns
A vector, a draw from the normal posterior distribution of the coefficient vector in a multiple linear regression.
Details
This function draws from the posterior distribution of β in the linear utility equation
Un=Xnβ+ϵn,
where Un is the (latent, but here assumed to be known) utility vector of decider n=1,…,N, Xn
is the design matrix build from the choice characteristics faced by n, β is the unknown coefficient vector (this can be either the fixed coefficient vector α or the decider-specific coefficient vector βn), and ϵn is the error term assumed to be normally distributed with mean 0
and (known) covariance matrix Σ. A priori we assume the (conjugate) normal prior distribution
β∼N(μ0,T0)
with mean vector μ0 and precision matrix (i.e. inverted covariance matrix) T0. The posterior distribution for β is normal with covariance matrix
Σ1=(T0+n=1∑NXn′Σ−1Xn)−1
and mean vector
μ1=Σ1(T0μ0+n=1∑NXn′Σ−1Un)
. Note the analogy of μ1 to the generalized least squares estimator
β^GLS=(n=1∑NXn′Σ−1Xn)−1n=1∑NXn′Σ−1Un
which becomes weighted by the prior parameters μ0 and T0.