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
using LinearAlgebra | |
function ichol(M) | |
!isposdef(M) ? error("Matrix must be positive semi-definite") : nothing | |
A = deepcopy(M) | |
n = size(A, 1) | |
for k in 1:n | |
A[k,k] = sqrt(A[k,k]) | |
for i in (k + 1):n | |
A[i,k] = A[i,k] / A[k,k] | |
end |
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
# Define F-Test function: w = waldtest([1 -1 0 0], rr1.coef, rr1.vcov) | |
function waldtest(R, β, Σ) | |
wald = (R * β)' * inv(R * Σ * R') * (R * β) | |
q = size(R)[1] | |
pval = 1 - cdf(Chisq(q), wald) | |
end |