11
ordpoisson(cutpoints, countdata=FALSE, NOS=NULL,
12
Levels=NULL, init.mu=NULL, parallel=FALSE,
13
zero=NULL, link="loge", earg = list())
11
ordpoisson(cutpoints, countdata = FALSE, NOS = NULL,
12
Levels = NULL, init.mu = NULL, parallel = FALSE,
13
zero = NULL, link = "loge", earg = list())
15
15
%- maybe also 'usage' for other objects documented here.
30
30
the response is expected to be in the same format as \code{fit@y}
31
31
where \code{fit} is a fitted model with \code{ordpoisson} as the
32
32
\pkg{VGAM} family function. That is, the response is matrix of counts
33
with \code{L} columns (if \code{NOS=1}).
33
with \code{L} columns (if \code{NOS = 1}).
37
37
Integer. The number of species, or more generally, the number of
38
38
response random variates.
39
This argument must be specified when \code{countdata=TRUE}.
39
This argument must be specified when \code{countdata = TRUE}.
40
Usually \code{NOS = 1}.
44
44
Integer vector, recycled to length \code{NOS} if necessary.
45
45
The number of levels for each response random variate.
46
46
This argument should agree with \code{cutpoints}.
47
This argument must be specified when \code{countdata=TRUE}.
47
This argument must be specified when \code{countdata = TRUE}.
84
85
\code{ordpoisson(cut = c(0, 5, 10, Inf, 20, 30, Inf, 0, 10, 40, Inf))}
89
91
An object of class \code{"vglmff"} (see \code{\link{vglmff-class}}).
90
92
The object is used by modelling functions such as \code{\link{vglm}}
91
93
and \code{\link{vgam}}.
96
101
\emph{Ordinal ordination with normalizing link functions for count data},
100
106
\author{ Thomas W. Yee }
117
125
\code{\link{polf}},
118
126
\code{\link[base:factor]{ordered}}.
131
set.seed(123) # Example 1
124
132
x2 = runif(n <- 1000); x3 = runif(n)
125
133
mymu = exp(3 - 1 * x2 + 2 * x3)
126
y1 = rpois(n, lambda=mymu)
134
y1 = rpois(n, lambda = mymu)
127
135
cutpts = c(-Inf, 20, 30, Inf)
128
136
fcutpts = cutpts[is.finite(cutpts)] # finite cutpoints
129
ystar = cut(y1, breaks=cutpts, labels=FALSE)
137
ystar = cut(y1, breaks = cutpts, labels = FALSE)
131
plot(x2, x3, col=ystar, pch=as.character(ystar))
139
plot(x2, x3, col = ystar, pch = as.character(ystar))
133
141
table(ystar) / sum(table(ystar))
134
fit = vglm(ystar ~ x2 + x3, fam = ordpoisson(cutpoi=fcutpts))
135
head(fit@y) # This can be input if countdata=TRUE
142
fit = vglm(ystar ~ x2 + x3, fam = ordpoisson(cutpoi = fcutpts))
143
head(fit@y) # This can be input if countdata = TRUE
136
144
head(fitted(fit))
137
145
head(predict(fit))
138
coef(fit, matrix=TRUE)
146
coef(fit, matrix = TRUE)
141
149
# Example 2: multivariate and there are no obsns between some cutpoints
142
150
cutpts2 = c(-Inf, 0, 9, 10, 20, 70, 200, 201, Inf)
143
151
fcutpts2 = cutpts2[is.finite(cutpts2)] # finite cutpoints
144
y2 = rpois(n, lambda=mymu) # Same model as y1
145
ystar2 = cut(y2, breaks=cutpts2, labels=FALSE)
152
y2 = rpois(n, lambda = mymu) # Same model as y1
153
ystar2 = cut(y2, breaks = cutpts2, labels = FALSE)
146
154
table(ystar2) / sum(table(ystar2))
147
155
fit = vglm(cbind(ystar,ystar2) ~ x2 + x3, fam =
148
ordpoisson(cutpoi=c(fcutpts,Inf,fcutpts2,Inf),
149
Levels=c(length(fcutpts)+1,length(fcutpts2)+1),
150
parallel=TRUE), trace=TRUE)
151
coef(fit, matrix=TRUE)
156
ordpoisson(cutpoi = c(fcutpts,Inf,fcutpts2,Inf),
157
Levels = c(length(fcutpts)+1,length(fcutpts2)+1),
158
parallel = TRUE), trace = TRUE)
159
coef(fit, matrix = TRUE)
154
162
summary(fit@y) # Some columns have all zeros