These functions calculate and differentiate a cumulative distribution function and density function of the standardized (to zero mean and unit variance) Student distribution. Quantile function and random numbers generator are also provided.
df: positive real value representing the number of degrees of freedom. Since this function deals with standardized Student distribution, argument df should be greater than 2 because otherwise variance is undefined.
log: logical; if TRUE then probabilities (or densities) p are given as log(p) and derivatives will be given respect to log(p).
grad_x: logical; if TRUE then function returns a derivative respect to x.
grad_df: logical; if TRUE then function returns a derivative respect to df.
n: positive integer. If rt0 function is used then this argument represents the number of random draws. Otherwise n states for the number of iterations used to calculate the derivatives associated with pt0 function via pbetaDiff function.
Returns
Function rt0 returns a numeric vector of random numbers. Function qt0 returns a numeric vector of quantiles. Functions pt0 and dt0 return a list which may contain the following elements:
prob - numeric vector of probabilities calculated for each element of x. Exclusively for pt0 function.
den - numeric vector of densities calculated for each each element of x. Exclusively for dt0 function.
grad_x - numeric vector of derivatives respect to p for each element of x. This element appears only if input argument grad_x is TRUE.
grad_df - numeric vector of derivatives respect to q for each element of x. This element appears only if input argument grad_df is TRUE.
Details
Standardized (to zero mean and unit variance) Student distribution has the following density and cumulative distribution functions:
f(x)=(v−2)πΓ(2v)Γ(2v+1)(1+v−2x2)−2v+1,F(x)={1−21I(x2+v−2v−2,2v,21), if x≥021I(x2+v−2v−2,2v,21), if x<0,
where v>2 is the number of degrees of freedom df and I(.) is a cumulative distribution function of beta distribution which is calculated by pbeta function.