statistics - Function for dpareto in R -
i'm wondering if has function dpareto written in r?
i'm not able utilize in built function in r can't install libraries.
thanks!
it's relatively easy rip out functions r packages, example, from:
http://cran.r-project.org/web/packages/vgam/vgam.pdf
dpareto <- function(x, location, shape, log = false) { if (!is.logical(log.arg <- log) || length(log) != 1) stop("bad input argument 'log'") rm(log) l = max(length(x), length(location), length(shape)) x = rep(x, length.out = l); location = rep(location, length.out = l); shape = rep(shape, length.out = l) logdensity = rep(log(0), length.out = l) xok = (x > location) logdensity[xok] = log(shape[xok]) + shape[xok] * log(location[xok]) - (shape[xok]+1) * log(x[xok]) if (log.arg) logdensity else exp(logdensity) } alpha <- 3; k <- exp(1); x <- seq(2.8, 8, len = 300) ## not run: plot(x, dpareto(x, location = alpha, shape = k), type = "l", main = "pareto density split 10 equal areas")
r statistics
No comments:
Post a Comment