I want to calculate a quantile of a specific distribution. Therefore I need the cdf. My distribution is a standardized Student's-t distribution, this can be written as \begin{align*} f(l|\nu) =(\pi (\nu-2))^{-\frac{1}{2}}\Gamma \left(\frac{\nu}{2} \right)^{-1} \Gamma \left(\frac{\nu+1}{2} \right) \left(1+\frac{l^2}{\nu-2} \right)^{-\frac{1+\nu}{2}} \end{align*}
This can be implemented in R with:
probabilityfunction<-function(x)(pinumber*(param-2))^(-1/2)*gamma(param
/2)^(-1)*gamma((param+1)/2)*(1+l^2/(param-2))^(-(1+param)/2)
Where pinumber is the value for pi and param
is the $\nu$. Lets say $\nu=5$. Then I can get the probability by just inserting a certain value for my l
. But I want to have the cumulative density, since I later want to compute the quantile. I thought about something like
cumsum(probabilityfunction(5))
to give me the cumulative value up to 5.
But obviously this does not work. How can I get the cumulative probability and later on the quantile?
EDIT: OK, I found a first improvement:
integrate(probabilityfunction,-Inf,2)
would be a good starting point, but how to do the other thing?
pi
. $\endgroup$