> On Jul 20, 2016, at 10:20 AM, Sachin Kuruvithadam <sac...@hotmail.it> wrote: > > > > 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.
No. Not clear at all. What vector delta? > 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? That expression inside the K()-function would return a single value. I worry that you are expecting the Alpha's to retain their distinct bases as would happen if they were true 3-vectors. > > > [[alternative HTML version deleted]] Crossposting to Rhelp and StackOverflow at the same time is deprecated. This is the case on Rhelp, anyway. As far as I can tell SO has no such advice. Please read the Posting Guide where you should see that HTML formatted postings are discouraged and that most attachments are scrubbed by the email server. There has already been a comment-response on SO where another person reported difficulty accessing that image. You would be more likely to learn R coding if you used R code to define an Omega matrix with "dummy" values for testing and then tried passing it just as a square matrix to a function. ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. David Winsemius Alameda, CA, USA ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.