[R] calculate quantiles of a custom function

VictorDelgado victor.maia at fjp.mg.gov.br
Tue Jan 3 17:42:39 CET 2012


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.



More information about the R-help mailing list