cexpon {VGAM} | R Documentation |
Maximum likelihood estimation for the exponential distribution with left and right censoring.
cexpon(link = "loge", location = 0)
link |
Character.
Parameter link function applied to the positive parameter rate.
See Links for more choices.
|
location |
Numeric of length 1, the known location parameter, A, say.
|
The family function assumes the response Y has density
f(y) = rate * exp(-rate * (y-A))
for y > A, where A is the known location parameter. By default, A=0. Then E(Y) = A + 1/rate (returned as the fitted values) and Var(Y) = 1/rate^2.
The data may be left-censored so that the true value would be less than
the observed value; else right-censored so that the true value would be
greater than the observed value. To indicate which type of censoring,
input extra = list(leftcensored = vec1, rightcensored = vec2)
where vec1
and vec2
are logical vectors the same length
as the response.
If the two components of this list are missing then
all the logical values are taken to be FALSE
.
The fitted object has these two components stored in the extra
slot.
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
,
and vgam
.
This function was adapted from exponential
which should
be used when there are no censored observations.
The fitted object has a component called "location"
stored in the
extra
slot which contains the value of the location parameter.
T. W. Yee
Evans, M., Hastings, N. and Peacock, B. (2000) Statistical Distributions, New York: Wiley-Interscience, Third edition.
n = 100 lambda = exp(-0.1) ystar = rexp(n, rate=lambda) L = 2 # Lower censoring point U = 3 # Upper censoring point y = pmax(L, ystar) # left censoring y = pmin(U, y) # right censoring ## Not run: hist(y) extra = list(leftcensored = ystar < L, rightcensored = ystar > U) fit = vglm(y ~ 1, cexpon, trace=TRUE, extra=extra) coef(fit, matrix=TRUE) Coef(fit) fit@extra