I am solving an asset pricing equations via discretizing an underlying Markov process, X \in R^d, resulting in \tilde{X} \sim \Pi, where \Pi is a transition matrix whose rows sum to unity, and all entries in [0,1].

Let \delta \in R^d be a constant vector s.t. \eta_t := \exp \left(\delta X_t \right) represents growth rate of discounted cash flows. Let \tilde{\eta_i} := \exp\left(\delta \tilde{X}_i \right) be its discretized counterpart.

The asset pricing equation in the continuous space is:

V(x) = \eta_t + \mathbb{E}[\eta_t \eta_{t+1} | X_t = x] + \mathbb{E}[\eta_t \eta_{t+1} \eta_{t+2}| X_t = x] + \cdots

Cleary V(x) >0 \ \forall x \in R^d, because \eta >0, and the solution is a stochastic integral.

The above asset-pricing equation has a recursive structure:

V(x) = \eta_t + \eta_t \mathbb{E}[V(X_{t+1}) | X_t = x].

For the discretized process \tilde{X}, the recursive structure results in a system of linear equations,

\vec{V} = \vec{\eta} + diag(\vec{\eta}) \Pi \vec{V},

whose solution is

\vec{V} = \left( \mathbb{I} - diag\left(\vec{\eta}\right) \Pi\right)^{-1} \vec{\eta}.

The issue I’m having is using the backslash operator to solve the systems of equations sometimes results in a solution where \vec{V} has large negative entries, even though domain knowledge tells me all entries should be positive.

Is there a way in Julia to solve a system of linear equations s.t. all elements of the solution are greater than 0?

Also, any tips on solving the indefinite stochastic integral are welcome. In my application X is a Markov-switching vector autoregression where D = 4.