close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Version 2 (modified by Víctor de Buen Remiro, 14 years ago) (diff)

--

Package BysPrior

BysPriorInf stands for Bayesian Prior Information and allows to define prior information handlers to be used in estimation systems (max-likelihood and bayesian ones).

A prior is a distribution function over a subset of the total set of variables of a model that expresses the knowledge about the phenomena behind the model.

The effect of a prior is to add the logarithm of its likelihood to the logarithm of the likelihood of the global model. So it can be two or more priors over some variables. For example, in order to stablish a truncated normal we can define a uniform over the feasible region and an unconstrainined normal.

In order to be estimated with NonLinGloOpt (max-likelihood) and BysSampler (Bayesian sampler), each prior must define methods to calculate the logarithm of the likelihood (except an additive constant), its gradient and its hessian, and an optional set of constraining inequations, in order to define the feasible region. Each inequation can be linear or not and the gradient must be also calculated. Note that this implies that priors should be continuous and two times differentiable and restrictions must be continuous and differerentiable, but this an admisible restricion in almost all cases.

Chained priors

A prior can depend on a set of parameters that can be defined as constant values or another subset of the model variables. For example we can define hierarquical structures among the variables using a latent variable that is the average of a normal prior for a subset of variables. We also can consider that the varianze of these normal prior is another variable and to define an inverse chi-square prior over this one.

Non informative priors

Let  \beta a uniform random variable in a region \Omega\in\mathbb{R}^{n} which likelihood function is

lk\left(\beta\right) \propto 1

Since the logarithm of the likelihood but a constant is zero, when log-likelihood is not defined for a prior, the default assumed will be the uniform distribution, also called non informative prior.

Domain prior

The easiest way, but one of the most important, to define non informative prior information is to stablish a domain interval for one or more variables.

In this cases, you mustn't to define the log-logarithm nor the constraining inequation functions, but simply it's needed to fix the lower and upper bounds:

 \beta\in\Omega\Longleftrightarrow l_{k}\leq\beta\leq u_{k}\wedge-\infty\leq l_{k}<u_{k}\leq\infty

Polytope prior

A polytope is defined by a system of arbitrary linear inequalities

 A\beta\leq a\wedge A\in\mathbb{R}^{r\times n}\wedge a\in\mathbb{R}^{r}

We can define this type of prior bye means of a set of  r inequations due NonLinGloOpt doesn't have any special behaviour for linear inequations, and it could be an inefficient implementation.

However we can define just one non linear inequation that is equivalent to the full set of linear inequations. If we define

 d\left(\beta\right)=A\beta-a=\left(d_{k}\left(\beta\right)\right)_{k=1\ldots r}

then

 D_{k}\left(\beta\right)=\begin{cases} 0 & \forall d_{k}\left(\beta\right)\leq0\\ d_{k}\left(\beta\right) & \forall d_{k}\left(\beta\right)>0\end{cases}

is a continuous function in  \mathbb{R}^{n}  and

 D_{k}^{3}\left(\beta\right)=\begin{cases} 0 & \forall d_{k}\left(\beta\right)\leq0\\ d_{k}^{3}\left(\beta\right) & \forall d_{k}\left(\beta\right)>0\end{cases}

is a continuous and differentiable in  \mathbb{R}^{n}

 \frac{\partial D_{k}^{3}\left(\beta\right)}{\partial\beta_{i}}=\begin{cases} 0 & \forall d_{k}\left(\beta\right)\leq0\\ 3d_{k}^{2}\left(\beta\right)A_{ki} & \forall d_{k}\left(\beta\right)>0\end{cases}

The feasibility condition can then be defined as a single continuous nonlinear inequality and twice differentiable everywhere

 g\left(\beta\right)=\underset{k=1}{\overset{r}{\sum}}D_{k}^{3}\left(\beta\right)\leq0

The gradient of this function is

 \frac{\partial g\left(\beta\right)}{\partial\beta_{i}}=3\underset{k=1}{\overset{r}{\sum}}D_{k}^{2}\left(\beta\right)A_{ki}

Multinormal prior

Scalar bounded normal prior

Inverse chi-square prior