%% Create Prior Model for Bayesian Lasso Regression
% Consider the multiple linear regression model that predicts the US real gross national product (GNPR) using a linear combination of industrial production index (IPI), total employment (E), and real wages (WR).
% \texttt{GNPR}_t=\beta_0+\beta_1\texttt{IPI}_t+\beta_2\texttt{E}_t+\beta_3\texttt{WR}_t+\varepsilon_t.
% For all t, \varepsilon_t is a series of independent Gaussian disturbances with a mean of 0 and variance \sigma^2.
% Assume these prior distributions:
% For j = 0,...,3, \beta_j\vert\sigma^2 has a Laplace distribution with a mean of 0 and a scale of \sigma^2 /\lambda, where \lambda is the shrinkage parameter. The coefficients are conditionally independent.
% \sigma^2 \sim IG(A,B). A and B are the shape and scale, respectively, of an inverse gamma distribution.
% Create a prior model for Bayesian linear regression. Specify the number of predictors p.

p = 3;
Mdl = lassoblm(p);

% PriorMdl is a lassoblm Bayesian linear regression model object representing the prior distribution of the regression coefficients and disturbance variance. At the command window, lassoblm displays a summary of the prior distributions.
% Alternatively, you can create a prior model for Bayesian lasso regression by passing the number of predictors to bayeslm and setting the ModelType name-value pair argument to 'lasso'.

MdlBayesLM = bayeslm(p,'ModelType','lasso')

% Mdl and MdlBayesLM are equivalent model objects.
%
% You can set writable property values of created models using dot notation. Set the regression coefficient names to the corresponding variable names.

Mdl.VarNames = ["IPI" "E" "WR"]

% MATLAB® associates the variable names to the regression coefficients in displays.
%
% Copyright 2018 The MathWorks, Inc.