Created
June 7, 2020 20:02
-
-
Save acarril/6954661c51f710b5a5a65ef6471a7136 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compute transition matrix based on a distribution | |
using LinearAlgebra, Distributions | |
function fTransitionMatrix(grid; dist = LogNormal()) | |
N = size(grid)[1] | |
Mat = UpperTriangular(transpose(repeat(grid, outer=[1, N])) .- grid) | |
prMat = cdf.(dist, Mat) | |
trMat = hcat(prMat[:, 2:end], ones(N)) .- prMat | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment