From: <statmobile_at_gmail.com>

Date: Thu, 15 Nov 2007 17:10:14 -0500

R-devel_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 15 Nov 2007 - 22:19:48 GMT

Date: Thu, 15 Nov 2007 17:10:14 -0500

Here is what I am essentially trying to accomplish when looking at the Gaussian kernel:

l(beta) = (y-X*beta)^T V^{-1} (y-X*beta)

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 always get the same result. Now my question is, should I expect weird and ugly things to happen when nesting SEXP functions such as this? Or is it even highly discouraged in general in C to do something like this?

If this should work, then I'll need to go through each one of the functions and try to diagnose where the problem lies. Yet if it shouldn't work, I'll stick with the first approach I have going now.

Thanks in advance for your input!

R-devel_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 15 Nov 2007 - 22:19:48 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Fri 16 Nov 2007 - 02:30:18 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel.
Please read the posting
guide before posting to the list.
*