Wei-han Liu
2009-Mar-07 06:08 UTC
[R] multivariate integration and partial differentiation
Could somebody share some tips on implementing multivariate integration and partial differentiation in R? For example, for a trivariate joint distribution (cumulative density function) of F(x,y,z), how to differentiate with respect to x and get the bivariate distribution (probability density function) of f(y,z). Or integrate f(x,y,z) with respect to x to get bivariate distribution of (y,z). Your sharing is appreciated. Wei-han Liu [[alternative HTML version deleted]]
Wei-han Liu
2009-Mar-07 06:14 UTC
[R] multivariate integration and partial differentiation
Could somebody share some tips on implementing multivariate integration and partial differentiation in R? For example, for a trivariate joint distribution (cumulative density function) of F(x,y,z), how to differentiate with respect to x and get the bivariate distribution (probability density function) of f(y,z). Or integrate f(x,y,z) with respect to x to get bivariate distribution of (y,z). Your sharing is appreciated. Wei-han Liu [[alternative HTML version deleted]]
The adapt package has multivariate integration. However, I am not sure you need the multivariate integration for the example you describe: you only need one dimensional integration. For this, you can check out ?integrate For differentiation, depending on how well behaved the cdf is, you could use ?diff to calculate approximations for the slope. HTH Andrew On Mar 7, 5:08?pm, Wei-han Liu <weihanliu2... at yahoo.com> wrote:> Could somebody share some tips on implementing multivariate integration and partial differentiation in R? > For example, for a trivariate joint distribution (cumulative density function) of F(x,y,z), how to differentiate with respect to x and get the bivariate distribution (probability density function) of f(y,z). Or integrate f(x,y,z) with respect to x to get bivariate distribution of (y,z). > Your sharing is appreciated. > > Wei-han Liu > > ? ? ? ? [[alternative HTML version deleted]] > > ______________________________________________ > R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Wei-han Liu
2009-Mar-07 14:37 UTC
[R] multivariate integration and partial differentiation
Hi R Users: Could somebody share some tips on implementing multivariate integration and partial differentiation in R? For example, for a trivariate joint distribution (cumulative density function) of F(x,y,z), how to differentiate with respect to x and get the bivariate distribution (probability density function) of f(y,z). Or integrate f(x,y,z) with respect to x to get bivariate distribution of (y,z). Your sharing is appreciated. Wei-han Liu [[alternative HTML version deleted]]
Ravi Varadhan
2009-Mar-08 00:09 UTC
[R] multivariate integration and partial differentiation
Hi, The "adapt" package might work, but note that it cannot handle infinite limits. So, integrate() is your best bet. Since you need to integrate out only one dimension, integrate() would work just fine. As for differentiation, you might try the grad() fucntion in the "numDeriv" package. Ravi. ____________________________________________________________________ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvaradhan at jhmi.edu ----- Original Message ----- From: Wei-han Liu <weihanliu2002 at yahoo.com> Date: Saturday, March 7, 2009 9:38 am Subject: [R] multivariate integration and partial differentiation To: r-help at r-project.org> Hi R Users: > > Could somebody share some tips on implementing multivariate > integration and partial differentiation in R? > > For example, for a trivariate joint distribution (cumulative density > function) of F(x,y,z), how to differentiate with respect to x and get > the bivariate distribution (probability density function) of f(y,z). > Or integrate f(x,y,z) with respect to x to get bivariate distribution > of (y,z). > > Your sharing is appreciated. > > Wei-han Liu > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > > PLEASE do read the posting guide > and provide commented, minimal, self-contained, reproducible code.