[R] Integration of functions with a vector argument

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Wed Jun 12 12:14:23 CEST 2024


How do you integrate perpendicular to a plane if you don't have a concept of 3d? In that direction the plane is just a point.

Vectors in R do not have any concept of "n by 1"... they are like a string of beads. When you take a column out of a matrix `a` using indexing b <- a[,j] the resulting vector can only be indexed along its length as b[i]. Such a vector is indistinguishable in structure from a[i,] which originated from a row.

So I would say you are tilting at windmills. If you want you can write a[, j, drop=FALSE] to end up with an n by 1 matrix... but that is not a vector, it is a matrix. I have reservations about the value of "integrating out" along a row in an n by 1 matrix... seems like a degenerate case and you would be better off not creating the n by 1 matrix in the first place. But then I left Matlab behind a long time ago.


On June 11, 2024 11:44:08 AM PDT, "Levine, Michael" <mlevins using purdue.edu> wrote:
>Hello all,
>
>I have a question concerning integration of a function of a multivariate argument with respect to one or more variables in r.  Let us say we have a function
>
>F <- function(x){ body of the function}
>
>Where x is, in general, a d by 1 vector with d>1.  Now I want to integrate out some of the coordinates of x, e.g. x[1] or x[2] or both of them etc. I'm well aware of how to integrate out e.g. y if a function is defined as f <- function (x,y) {body of the function} where y is a scalar.
>However, it seems to be quite difficult to do the same if the function is defined with a vector argument x. At the very least, I haven't seen any good examples of this being done.
>Any suggestions?
>
>Yours sincerely,
>Michael
>
>Michael Levine
>Associate Professor, Statistics
>
>Department of Statistics
>Purdue University
>250 North University Street
>West Lafayette, IN 47907 USA
>
>email: mlevins using purdue.edu
>Phone: +1-765-496-7571
>Fax:   +1-765-494-0558
>URL:   www.stat.purdue.edu/~mlevins
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help using 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.

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list