11
nbolf(theta, earg = stop("'earg' must be given"), inverse = FALSE,
12
deriv = 0, short = TRUE, tag = FALSE)
11
nbolf(theta, earg = stop("argument 'earg' must be given"),
12
inverse = FALSE, deriv = 0, short = TRUE, tag = FALSE)
14
14
%- maybe also 'usage' for other objects documented here.
27
27
The cutpoints should be non-negative integers.
28
28
If \code{nbolf()} is used as the link function in
29
29
\code{\link{cumulative}} then one should choose
30
\code{reverse=TRUE, parallel=TRUE, intercept.apply=TRUE}.
30
\code{reverse = TRUE, parallel = TRUE, intercept.apply = TRUE}.
57
57
an ordinal response coming from an underlying negative binomial
60
61
The arguments \code{short} and \code{tag} are used only if
61
62
\code{theta} is character.
63
65
See \code{\link{Links}} for general information about \pkg{VGAM}
68
See Yee (2007) for details.
71
See Yee (2011) for details.
73
77
\emph{Ordinal ordination with normalizing link functions for count data},
77
82
\author{ Thomas W. Yee }
84
89
\code{theta} is too close to 1 or 0,
85
90
numerical instabilities may still arise.
87
93
In terms of the threshold approach with cumulative probabilities for
88
94
an ordinal response this link function corresponds to the negative
89
95
binomial distribution (see \code{\link{negbinomial}}) that has been
90
96
recorded as an ordinal response using known cutpoints.
93
100
\section{Warning }{
94
101
Prediction may not work on \code{\link{vglm}} or
95
102
\code{\link{vgam}} etc. objects if this link function is used.
105
113
\code{\link{cumulative}}.
109
earg = list(cutpoint=2, k=1)
110
nbolf("p", earg=earg, short=FALSE)
111
nbolf("p", earg=earg, tag=TRUE)
113
p = seq(0.02, 0.98, by=0.01)
114
y = nbolf(p, earg=earg)
115
y. = nbolf(p, earg=earg, deriv=1)
116
max(abs(nbolf(y, earg=earg, inv=TRUE) - p)) # Should be 0
119
par(mfrow=c(2,1), las=1)
120
plot(p, y, type="l", col="blue", main="nbolf()")
121
abline(h=0, v=0.5, col="red", lty="dashed")
123
plot(p, y., type="l", col="blue",
124
main="(Reciprocal of) first NBOLF derivative")
118
earg = list(cutpoint = 2, k = 1)
119
nbolf("p", earg = earg, short = FALSE)
120
nbolf("p", earg = earg, tag = TRUE)
122
p = seq(0.02, 0.98, by = 0.01)
123
y = nbolf(p, earg = earg)
124
y. = nbolf(p, earg = earg, deriv = 1)
125
max(abs(nbolf(y, earg = earg, inv = TRUE) - p)) # Should be 0
127
\dontrun{ par(mfrow = c(2, 1), las = 1)
128
plot(p, y, type = "l", col = "blue", main = "nbolf()")
129
abline(h = 0, v = 0.5, col = "red", lty = "dashed")
131
plot(p, y., type = "l", col = "blue",
132
main = "(Reciprocal of) first NBOLF derivative") }
127
134
# Another example
131
138
mymu = exp( 3 + 1 * x2 - 2 * x3)
133
y1 = rnbinom(nn, mu=mymu, size=k)
140
y1 = rnbinom(nn, mu = mymu, size = k)
134
141
cutpoints = c(-Inf, 10, 20, Inf)
135
cuty = Cut(y1, breaks=cutpoints)
137
plot(x2, x3, col=cuty, pch=as.character(cuty))
142
cuty = Cut(y1, breaks = cutpoints)
143
\dontrun{ plot(x2, x3, col = cuty, pch = as.character(cuty)) }
139
144
table(cuty) / sum(table(cuty))
140
fit = vglm(cuty ~ x2 + x3, fam = cumulative(link="nbolf",
141
reverse=TRUE, parallel=TRUE, intercept.apply=TRUE,
142
mv=TRUE, earg=list(cutpoint=cutpoints[2:3], k=k)),
145
fit = vglm(cuty ~ x2 + x3, fam = cumulative(link = "nbolf",
146
reverse = TRUE, parallel = TRUE, intercept.apply = TRUE,
147
mv = TRUE, earg = list(cutpoint = cutpoints[2:3], k = k)),
145
150
head(fitted(fit))
146
151
head(predict(fit))
148
coef(fit, matrix=TRUE)
153
coef(fit, matrix = TRUE)