R/weibull_fun.R

Defines functions weibull_fun

Documented in weibull_fun

#' Weibull function
#'
#' Weibull function of the form \eqn{ (1 - exp(-(x/\alpha)^\beta)}
#' @param x Vector of values of the explanatory variable.
#' @param p Vector of parameters \eqn{p = c(\alpha, \beta)}.
#' @return Probability at each \code{x}.
#' @examples
#' library(ggplot2)
#' xseq <- seq(0, 4, .01)
#' yseq <- weibull_fun(xseq, c(2, 4))
#' curve <- data.frame(x = xseq, y = yseq)
#' ggplot(curve, aes(x = x, y = y)) + geom_line()
#' @export
#' @importFrom stats pweibull
weibull_fun <- function(x, p) pweibull(x, p[2], p[1])
danilinares/quickpsy documentation built on Feb. 13, 2023, 8:44 p.m.