%% Custom Multivariate _t_ Prior Model For Coefficients
% Consider the linear regression model in
% <docid:econ_ug.bvllq77-1 Default Diffuse Prior Model>. Assume these prior
% distributions:
%
% * $\beta_j\vert\sigma^2$ is 4-D _t_ distribution with 50
% degrees of freedom for each component and the identity matrix for the
% correlation matrix.  Also, the distribution is centered at ${\left[
% {\begin{array}{*{20}{c}} { - 25}&4&0&3 \end{array}} \right]^\prime }$ and
% each component is scaled by the corresponding elements of the vector
% ${\left[ {\begin{array}{*{20}{c}} {10}&1&1&1 \end{array}}
% \right]^\prime }$.
%
% * $\sigma^2 \sim IG(3,1)$.
%
% |bayeslm| treats these assumptions and the data likelihood as if the
% corresponding posterior is analytically intractable.
%%
% Declare a MATLAB(R) function that:
%
% * Accepts values of $\beta$ and $\sigma^2$ together in a column vector,
% and accepts values of the hyperparameters
% * Returns the value of the joint prior distribution,
% $\pi\left(\beta,\sigma^2\right)$, given the values of $\beta$ and
% $\sigma^2$
%
% <include>priorMVTIG.m</include>
%
%%
% Create an anonymous function that operates like |priorMVTIG|, but accepts the
% parameter values only and holds the hyperparameter values fixed.
dof = 50;
C = eye(4);
ct = [-25; 4; 0; 3];
st = [10; 1; 1; 1];
a = 3;
b = 1;
prior = @(params)priorMVTIG(params,ct,st,dof,C,a,b);
%%
% Create a custom joint prior model for the linear regression parameters.
% Specify the number of predictors |p|. Also, specify the function handle
% for |priorMVTIG|, and pass the hyperparameter values.
p = 3;
Mdl = bayeslm(p,'ModelType','custom','LogPDF',prior)
%%
% |Mdl| is a |customblm| Bayesian linear regression model object
% representing the prior distribution of the regression coefficients and
% disturbance variance. In this case, |bayeslm| does not display a summary
% of the prior distributions at the command line.

%% 
% Copyright 2012 The MathWorks, Inc.