# Need to solve the stochastic differential equation of Vasicek Model

How to solve the stochastic differential equation of the Vasicek model for the analysis of credit risk? I search in the article "The Distribution of loan portfolio value" (Vasicek) but he doesn't solve the equation.

$$dA_i=\mu_i A_i dt+\sigma_i A_i dx_i$$

The solution is:

$$log A_i(T)=log A_i+\mu_i T-\frac{1}{2}\sigma_i^2T+\sigma_i\sqrt{T}X_i$$

The probability of default of the i-th loan is then

$$p_i=P[A_i(T)

where

$$c_i=\frac{log B_i-log A_i-\mu_i T+\frac{1}{2}\sigma_i^2T}{\sigma_i\sqrt{T}}$$

and N is the cumulative normal distribution function.

• The first equation is just the geometric brownian, and you can find its solution here: math.stackexchange.com/questions/873704/… Apr 21 '19 at 0:17
• And to compute the probability, you will need to substitute the solution you have for A_i, and then isolate X, on the left hand side. Apr 21 '19 at 0:21
• @Magicisinthechain I went to the link you sent and tried to solve the differential equation from the beginning. T is the maturation time of the credit. The problem is that if we pass everything to the logarithm, in the formula that I wrote in the question appears $\sqrt{T}$ in $\sigma_i\sqrt{T}X_i$ and in the post that you sent me does not appear that term. Do you know how to get that missing term? Apr 21 '19 at 2:15
• It will be Brownian motion in the solution. As BM has mean zero and variance T (standard deviation equal to square root of T), you can write it as sqrt T times standard normal for simulation purpose. Apr 21 '19 at 14:19