User Tools

Site Tools


lab:mediation_model_maple_codes
Iden := Matrix(3, 3, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1})

A := Matrix(3, 3, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (2, 1) = a, (2, 2) = 0, (2, 3) = 0, (3, 1) = c, (3, 2) = b, (3, 3) = 0})

S := Matrix(3, 3, {(1, 1) = sigma[1]^2, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = sigma[2]^2, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = sigma[3]^2})

with(linalg):

omega := multiply(multiply(inverse(Iden-A), S), transpose(inverse(Iden-A)))

Matrix(3, 3, {(1, 1) = sigma[1]^2, (1, 2) = a*sigma[1]^2, (1, 3) = (a*b+c)*sigma[1]^2, (2, 1) = a*sigma[1]^2, (2, 2) = a^2*sigma[1]^2+sigma[2]^2, (2, 3) = a*sigma[1]^2*(a*b+c)+b*sigma[2]^2, (3, 1) = (a*b+c)*sigma[1]^2, (3, 2) = a*sigma[1]^2*(a*b+c)+b*sigma[2]^2, (3, 3) = (a*b+c)^2*sigma[1]^2+b^2*sigma[2]^2+sigma[3]^2})
lab/mediation_model_maple_codes.txt · Last modified: 2016/01/24 09:48 by 127.0.0.1