Re: [R] The Percentile of a User-Defined pdf

2011-01-17 Thread Nissim Kaufmann
I got it to work: # To get a percentile of a single-variable function: # Step 1: Integrate over the domain to ge the normalization constant: Z<-integrate(function(x) sqrt(1+x^-1), 1,2)$value Z # Step 2: Find the .975 percentile x975<-uniroot(function(t) integrate(function(x) sqrt(1+x^-1), 1, t)$val

Re: [R] The Percentile of a User-Defined pdf

2011-01-02 Thread David Winsemius
On Jan 1, 2011, at 10:42 PM, Nissim Kaufmann wrote: I would like to give a probability distribution function of a function of (x,y) on the half-plane y>0, and a constant 0to know the c percentile of the marginal distribution of x. I have tried along the lines of the following but I keep ge

Re: [R] The Percentile of a User-Defined pdf

2011-01-02 Thread Dieter Menne
Nissim Kaufmann wrote: > > > J=sapply(xc, function(xc) {integrate(function(x) { >sapply(y, function(x) { > integrate(function(y) { >sapply(x, function(y) 1/(1+x^2+y^2)) > }, -c, c)$value >}) > }, -c, xc)$value > }) > > Once you are inside the first "{", R only kn

[R] The Percentile of a User-Defined pdf

2011-01-01 Thread Nissim Kaufmann
I would like to give a probability distribution function of a function of (x,y) on the half-plane y>0, and a constant 0https://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, reproducib