Displaying 1 result from an estimated 1 matches for "pt5".
Did you mean:
pt
2007 Nov 15
1
Nested SEXP functions
...); // X-Y
SEXP tX(SEXP X); // X^T
SEXP mycholinv(SEXP V); // Use cholesky decomposition for inverse
Now, what I'm noticing is that if I call each routine individually
such as:
pt1=XtimesY(X,beta); // X*beta
pt2=Xminus(Y,pt1); // Y-X*beta
pt3=tX(pt2); // (Y-X*beta)^T
pt4=mycholinv(V); //V^{-1}
pt5=XtimesY(pt2,pt4); // (Y-X*beta)^T V^{-1}
result=XtimesY(pt5,pt2); //(y-X*beta)^T V^{-1} (y-X*beta)
Then the result is correct. But if instead I want to save some lines
of code, and I use:
result=XtimesY(XtimesY(tX(XminusY(Y,XtimesY(X,beta))),mycholinv(V)),XminusY(Y,XtimesY(X,beta)))
I don't...