f <- function(x) pbeta(x, shape1=2, shape2=3)
  f.inv <- inverse(f,lower=0,upper=1)
  [1] 0.3857168

I don't understand the result of the Code.

When I imagine the inverse function of pbeta, then on the $x$-axis are the probabilities and on the $y$-axis are the values from the $x$-variable.

Input f.inv (.5) is equal to the median or isn't it?

So I expected a value from the $x$-variable more exact 495. What is the meaning of the result 0.3857168?

The documentation was not a great help.

  • 3
    $\begingroup$ There is no inverse function in R. If you are using a package, you need to specify it. $\endgroup$ – Roland Mar 2 '17 at 15:55
  • 1
    $\begingroup$ Sorry. The package is GoFKernel. $\endgroup$ – Hark Mar 2 '17 at 15:57
  • 2
    $\begingroup$ It is pretty obvious from it's name and the description "Function to calculate the inverse function of a cumulative distribution function." ... $\endgroup$ – Tim Mar 2 '17 at 16:05
  • 3
    $\begingroup$ If there's a statistical question here you need to spell it out. You seem to be confusing the dummy variable x used inside the function f with the vector of integers x: the median of the Beta(2,3) distribution is indeed 0.3857, & the median of those integers is indeed 495, but one has nothing to do with the other & it's not clear why you think it should. $\endgroup$ – Scortchi - Reinstate Monica Mar 2 '17 at 16:13
> pbeta(0.3857168,shape1=2, shape2=3)
[1] 0.4999812

Apart from that, your code


is useless, as this x is not used later in the given code. This may indicate a fundamental misunderstanding concerning the expression <- function(x)...


Not the answer you're looking for? Browse other questions tagged or ask your own question.