[R] System of equations with unknowns in R

Sachin Kuruvithadam sacios at hotmail.it
Wed Jul 20 19:20:16 CEST 2016



I have a 3x3 matrix Omega whose elements are unknown, and a defined 3x1 parameter vector alpha. I want to define a 3x1 vector delta whose elements are still unknown but depend on alpha and Omega as shown in this image (sorry, but when I write in Latex format it doesn't appear formatted in my preview):

https://www.dropbox.com/home/Public?preview=model.png

The term in the brackets simplifies into a number K, so I wrote this function:

Alpha=c(-0.248,1.092,-0.518)
K=function(gamma1,gamma2,gamma3,gamma12,gamma23,gamma13){
    (1+Alpha[1]*(Alpha[1]+Alpha[2]*gamma12/(gamma1*gamma2)+Alpha[3]*gamma13/(gamma1*gamma3)))^(-1/2)
    }

gamma1, gamma2, gamma3 are the elements in the diagonal of the 3x3 matrix Omega, whereas gamma12, gamma13, gamma23 are the off-diagonal elements (each elements repeats itself twice, e.g. gamma12=gamma21). So, by putting 6 arbitrary values in K() I get the scalar. So far so clear.

The rest I'm not sure about. I want R to return me a vector delta defined as shown above. How can I write a function that would perform this algebraic calculation, and return a 3x1 vector delta whose elements are the same unknowns as in Omega, but shifted/multiplied by the numbers in alpha?


	[[alternative HTML version deleted]]



More information about the R-help mailing list