distr | R Documentation |
This function can be used to call any of the 4 functions specific to a given probability distribution available in R.
distr(x, dist, param, type = "d", model = NULL, ...)
x |
Vector (or array) of quantiles, vector (or array) of probabilities, or number of observations. |
dist |
Distribution name. |
param |
Vector (or array) of parameters. |
type |
Type of function to be called ( |
model |
Object from the class |
... |
Additional arguments |
For each distribution available in R, 4 functions can be called. For example, for the normal distribution, the following 4 functions are available: dnorm
, pnorm
, qnorm
, and rnorm
. For the normal distribution, based on the argument type
, distr
may be used to call any one of the previous four functions.
Returns the density, the distribution function, the quantile function, or random variates.
Most functions in FAmle
rely upon distr
.
## Example 1 dnorm(-4:4,0,1,log=TRUE) distr(-4:4,'norm',c(0,1),type='d',log=TRUE) ## Example 2 mu.vec <- c(1,100,100) sigma.vec <- c(1,11,111) n <- 3 set.seed(123) rnorm(n,mu.vec,sigma.vec) set.seed(123) distr(n,'norm',cbind(mu.vec,sigma.vec),'r') ## Example 3 qnorm(.9,mu.vec,sigma.vec) distr(.9,'norm',cbind(mu.vec,sigma.vec),'q')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.