Last chance! 50% off unlimited learning
Sale ends in
geometric(link = "logit", expected = TRUE, imethod = 1,
iprob = NULL, zero = NULL)
truncgeometric(upper.limit = Inf,
link = "logit", expected = TRUE, imethod = 1,
iprob = NULL, zero = NULL)
Links
for more choices.expected = TRUE
, else Newton-Raphson.CommonVGAMffArguments
for more details."vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
,
and vgam
.negbinomial
).
If $Y$ has a geometric distribution with parameter $p$ then
$Y+1$ has a positive-geometric distribution with the same parameter.
Multiple responses are permitted.
For truncgeometric()
,
the (upper) truncated geometric distribution can have response integer
values from 0 to upper.limit
.
It has density prob * (1 - prob)^y / [1-(1-prob)^(1+upper.limit)]
.
For a generalized truncated geometric distribution with integer values $L$ to $U$, say, subtract $L$ from the response and feed in $U-L$ as the upper limit.
negbinomial
,
Geometric
,
betageometric
,
expgeometric
,
zageometric
,
zigeometric
,
rbetageom
.gdata <- data.frame(x2 = runif(nn <- 1000) - 0.5)
gdata <- transform(gdata, x3 = runif(nn) - 0.5,
x4 = runif(nn) - 0.5)
gdata <- transform(gdata, eta = -1.0 - 1.0 * x2 + 2.0 * x3)
gdata <- transform(gdata, prob = logit(eta, inverse = TRUE))
gdata <- transform(gdata, y1 = rgeom(nn, prob))
with(gdata, table(y1))
fit1 <- vglm(y1 ~ x2 + x3 + x4, geometric, gdata, trace = TRUE)
coef(fit1, matrix = TRUE)
summary(fit1)
# Truncated geometric (between 0 and upper.limit)
upper.limit <- 5
tdata <- subset(gdata, y1 <= upper.limit)
nrow(tdata) # Less than nn
fit2 <- vglm(y1 ~ x2 + x3 + x4, truncgeometric(upper.limit),
data = tdata, trace = TRUE)
coef(fit2, matrix = TRUE)
# Generalized truncated geometric (between lower.limit and upper.limit)
lower.limit <- 1
upper.limit <- 8
gtdata <- subset(gdata, lower.limit <= y1 & y1 <= upper.limit)
with(gtdata, table(y1))
nrow(gtdata) # Less than nn
fit3 <- vglm(y1 - lower.limit ~ x2 + x3 + x4,
truncgeometric(upper.limit - lower.limit),
data = gtdata, trace = TRUE)
coef(fit3, matrix = TRUE)
Run the code above in your browser using DataLab