[R] calculate quantiles of a custom function
Bert Gunter
gunter.berton at gene.com
Tue Jan 3 15:41:26 CET 2012
Gerhard:
Strictly speaking, it's quantiles of a custom "distribution", not function.
There may be some way to handle your example easily, but, in general,
you would need to solve the resulting integral equation. This is hard
-- closed form solutions rarely exist; good approximations require
work.
So a standard approach is: simulate. Indeed, many simulation tricks
(under the rubric of "variance reduction") have been developed exactly
for such monte carlo integration. Consult a good reference or
knowledgeable person for details.
-- Bert
On Tue, Jan 3, 2012 at 4:24 AM, Gerhard <feldspat at gmx.net> wrote:
> Hi,
>
> I guess that my problem has an obvious answer, but I have not been able to
> find it.
>
> 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?
>
> I have not seen any continous function treated in the docs, and applying the
> "quantile function" gives me an error (since it seems only to be defined on
> lists and atoms).
>
> Thank you in advance,
>
> Gerhard
>
> ______________________________________________
> R-help at 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.
--
Bert Gunter
Genentech Nonclinical Biostatistics
Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
More information about the R-help
mailing list