FWIW, the integral of a mixture density is the same mixture of the CDFs, so you can use the pbeta functions:

 pcustom <- function(x) (pbeta(x,2,6) + pbeta(x,6,2))/2

albyn

Quoting Gerhard <felds...@gmx.net>:

Am Dienstag, 3. Januar 2012, 19:51:36 schrieb Prof. Dr. Matthias Kohl:
D <- AbscontDistribution(d = function(x) dbeta(x, 2, 6) + dbeta(x,6,2),
low = 0, up = 1, withStand = TRUE)

Dear all,

thank you all again for your help.

So, summing up, (in case this might be useful to other beginners - like me)
this is how it can be done:

############################
library(distr)

dcustom <- function(x) {
  (dbeta(x,2,6) + dbeta(x,6,2))/2        # I need to divide by 2 to get 1 as
                                                                 # result of 
integration;
}

pcustom <- function(x) {
  integrate(dmyspeaker,0,x)$value
}

D <- AbscontDistribution(d = dcustom, low = 0, up = 1, withStand = TRUE)

qcustom <- function(x){
  q(D)(x)
}
############################

Best,

Gerhard

______________________________________________
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.

Reply via email to