Dear Gerhard,

you could also use package "distr"; e.g.

library(distr)

## use generating function "AbscontDistribution"
D <- AbscontDistribution(d = function(x) dbeta(x, 2, 6) + dbeta(x,6,2), low = 0, up = 1, withStand = TRUE)

## quantiles
q(D)(seq(0,1,0.1))

Best
Matthias

On 03.01.2012 19:33, Albyn Jones wrote:
What do quantiles mean here? If you have a mixture density, say

myf <- function(x,p0) p0*dbeta(x,2,6) + (1-p0)*dbeta(x,6,2)

then I know what quantiles mean. To find the Pth quantile use uniroot to
solve for the x such that myf(x,p0) - P =0.

albyn

Quoting VictorDelgado <victor.m...@fjp.mg.gov.br>:


Gerhard wrote


Suppose I create a custom function, consisting of two
beta-distributions:

myfunction <- function(x) {
dbeta(x,2,6) + dbeta(x,6,2)
}

How can I calculate the quantiles of myfunction?

Thank you in advance,

Gerhard



Gehard, if do you want to know the quantiles of the new distribution
created
by "myfunction". Maybe you can also do:

x <- seq(0,1,.01) # insert your 'x'
q <- myfunction(x)
# And:
quantile(x)

0% 25% 50% 75% 100%
0.000000 1.476177 2.045389 2.581226 2.817425

# This gives the sample quantiles. You can also look foward to
simulations
(like Bert Gunter had suggested) to know better the properties of
distributions quantiles obtained after 'myfunction'.



-----
Victor Delgado
cedeplar.ufmg.br P.H.D. student
www.fjp.mg.gov.br reseacher
--
View this message in context:
http://r.789695.n4.nabble.com/calculate-quantiles-of-a-custom-function-tp4256887p4257551.html

Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
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.



______________________________________________
R-help@r-project.org mailing list
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.

--
Prof. Dr. Matthias Kohl
www.stamats.de

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to