utilitiesForPiecewiseExponentialDistribution {rpact} | R Documentation |
Distribution function, quantile function and random number generation for the piecewise exponential distribution.
getPiecewiseExponentialDistribution(
time,
...,
piecewiseSurvivalTime = NA_real_,
piecewiseLambda = NA_real_,
kappa = 1
)
ppwexp(t, ..., s = NA_real_, lambda = NA_real_, kappa = 1)
getPiecewiseExponentialQuantile(
quantile,
...,
piecewiseSurvivalTime = NA_real_,
piecewiseLambda = NA_real_,
kappa = 1
)
qpwexp(q, ..., s = NA_real_, lambda = NA_real_, kappa = 1)
getPiecewiseExponentialRandomNumbers(
n,
...,
piecewiseSurvivalTime = NA_real_,
piecewiseLambda = NA_real_,
kappa = 1
)
rpwexp(n, ..., s = NA_real_, lambda = NA_real_, kappa = 1)
... |
Ensures that all arguments (starting from the "...") are to be named and that a warning will be displayed if unknown arguments are passed. |
kappa |
A numeric value > 0. A |
t , time |
Vector of time values. |
s , piecewiseSurvivalTime |
Vector of start times defining the "time pieces". |
lambda , piecewiseLambda |
Vector of lambda values (hazard rates) corresponding to the start times. |
q , quantile |
Vector of quantiles. |
n |
Number of observations. |
getPiecewiseExponentialDistribution()
(short: ppwexp()
),
getPiecewiseExponentialQuantile()
(short: qpwexp()
), and
getPiecewiseExponentialRandomNumbers()
(short: rpwexp()
) provide
probabilities, quantiles, and random numbers according to a piecewise
exponential or a Weibull distribution.
The piecewise definition is performed through a vector of
starting times (piecewiseSurvivalTime
) and a vector of hazard rates (piecewiseLambda
).
You can also use a list that defines the starting times and piecewise
lambdas together and define piecewiseSurvivalTime as this list.
The list needs to have the form, e.g.,
piecewiseSurvivalTime <- list(
"0 - <6" = 0.025,
"6 - <9" = 0.04,
"9 - <15" = 0.015,
">=15" = 0.007) .
For the Weibull case, you can also specify a shape parameter kappa in order to
calculate probabilities, quantiles, or random numbers.
In this case, no piecewise definition is possible, i.e., only piecewiseLambda
(as a single value) and kappa need to be specified.
A numeric
value or vector will be returned.
## Not run:
# Calculate probabilties for a range of time values for a
# piecewise exponential distribution with hazard rates
# 0.025, 0.04, 0.015, and 0.007 in the intervals
# [0, 6), [6, 9), [9, 15), [15, Inf), respectively,
# and re-return the time values:
piecewiseSurvivalTime <- list(
"0 - <6" = 0.025,
"6 - <9" = 0.04,
"9 - <15" = 0.015,
">=15" = 0.01
)
y <- getPiecewiseExponentialDistribution(seq(0, 150, 15),
piecewiseSurvivalTime = piecewiseSurvivalTime
)
getPiecewiseExponentialQuantile(y,
piecewiseSurvivalTime = piecewiseSurvivalTime
)
## End(Not run)