Ordinal Regression with Continuation Ratios
cratio.RdFits a continuation ratio logit/probit/cloglog/cauchit/... regression model to an ordered (preferably) factor response.
Usage
cratio(link = "logitlink", parallel = FALSE, reverse = FALSE,
zero = NULL, ynames = FALSE, Thresh = NULL, Trev = reverse,
Tref = if (Trev) "M" else 1, Intercept = NULL, whitespace = FALSE)Arguments
- link
Link function applied to the \(M\) continuation ratio probabilities. See
Linksfor more choices.- parallel
A logical, or formula specifying which terms have equal/unequal coefficients.
- reverse
Logical. By default, the continuation ratios used are \(\eta_j = logit(P[Y>j|Y \geq j])\) for \(j=1,\dots,M\). If
reverseisTRUE, then \(\eta_j = logit(P[Y<j+1|Y\leq j+1])\) will be used.- ynames
See
multinomialfor information.- zero
An integer-valued vector specifying which linear/additive predictors are modelled as intercepts only. The values must be from the set {1,2,...,\(M\)}. The default value means none are modelled as intercept-only terms. See
CommonVGAMffArgumentsfor more information.- Thresh, Trev, Tref, Intercept
See
cumulativefor information. These arguments apply to ordinal categorical regression models.- whitespace
See
CommonVGAMffArgumentsfor information.
Details
In this help file the response \(Y\) is assumed to be a factor with ordered values \(1,2,\dots,M+1\), so that \(M\) is the number of linear/additive predictors \(\eta_j\).
There are a number of definitions for the
continuation ratio
in the literature. To make life easier, in the VGAM
package, we use continuation ratios and stopping
ratios
(see sratio).
Stopping ratios deal with quantities such as
logitlink(P[Y=j|Y>=j]).
Value
An object of class "vglmff"
(see vglmff-class).
The object is used by modelling functions
such as vglm,
rrvglm
and vgam.
References
See sratio.
Note
The response should be either a matrix of counts
(with row sums that are all positive), or a
factor. In both cases, the y slot returned by
vglm/vgam/rrvglm is the matrix
of counts.
For a nominal (unordered) factor response, the
multinomial logit model (multinomial)
is more appropriate.
Here is an example of the usage of the parallel
argument. If there are covariates x1, x2
and x3, then parallel = TRUE ~ x1 + x2 -1
and parallel = FALSE ~ x3 are equivalent. This
would constrain the regression coefficients for x1
and x2 to be equal; those of the intercepts and
x3 would be different.
Warning
No check is made to verify that the response is ordinal if the
response is a matrix;
see ordered.
Boersch-Supan (2021) looks at sparse data and
the numerical problems that result;
see sratio.
Examples
pneumo <- transform(pneumo, let = log(exposure.time))
(fit <- vglm(cbind(normal, mild, severe) ~ let,
cratio(parallel = TRUE), data = pneumo))
#>
#> Call:
#> vglm(formula = cbind(normal, mild, severe) ~ let, family = cratio(parallel = TRUE),
#> data = pneumo)
#>
#>
#> Coefficients:
#> (Intercept):1 (Intercept):2 let
#> -8.733797 -8.051302 2.321359
#>
#> Degrees of Freedom: 16 Total; 13 Residual
#> Residual deviance: 7.626763
#> Log-likelihood: -26.39023
coef(fit, matrix = TRUE)
#> logitlink(P[Y>1|Y>=1]) logitlink(P[Y>2|Y>=2])
#> (Intercept) -8.733797 -8.051302
#> let 2.321359 2.321359
constraints(fit)
#> $`(Intercept)`
#> [,1] [,2]
#> [1,] 1 0
#> [2,] 0 1
#>
#> $let
#> [,1]
#> [1,] 1
#> [2,] 1
#>
predict(fit)
#> logitlink(P[Y>1|Y>=1]) logitlink(P[Y>2|Y>=2])
#> 1 -4.6531774 -3.9706824
#> 2 -2.4474398 -1.7649448
#> 3 -1.6117442 -0.9292491
#> 4 -1.0403809 -0.3578859
#> 5 -0.5822388 0.1002563
#> 6 -0.1997827 0.4827124
#> 7 0.1538548 0.8363499
#> 8 0.4160301 1.0985252
predict(fit, untransform = TRUE)
#> P[Y>1|Y>=1] P[Y>2|Y>=2]
#> 1 0.009441281 0.01851142
#> 2 0.079625970 0.14617212
#> 3 0.166346597 0.28307708
#> 4 0.261076501 0.41147144
#> 5 0.358417612 0.52504310
#> 6 0.450219786 0.61838815
#> 7 0.538388014 0.69769591
#> 8 0.602532898 0.74998366
margeff(fit)
#> , , 1
#>
#> normal mild severe
#> (Intercept) 0.08167972 -0.07878663 -0.0028930983
#> let -0.02170968 0.02090961 0.0008000745
#>
#> , , 2
#>
#> normal mild severe
#> (Intercept) 0.6400622 -0.4664909 -0.17357136
#> let -0.1701224 0.1221861 0.04793632
#>
#> , , 3
#>
#> normal mild severe
#> (Intercept) 1.2111629 -0.5965056 -0.6146573
#> let -0.3219154 0.1524215 0.1694939
#>
#> , , 4
#>
#> normal mild severe
#> (Intercept) 1.6848854 -0.4825758 -1.202310
#> let -0.4478263 0.1167953 0.331031
#>
#> , , 5
#>
#> normal mild severe
#> (Intercept) 2.0083753 -0.23426941 -1.7741059
#> let -0.5338068 0.04605304 0.4877538
#>
#> , , 6
#>
#> normal mild severe
#> (Intercept) 2.1618063 0.03043788 -2.1922442
#> let -0.5745873 -0.02736296 0.6019503
#>
#> , , 7
#>
#> normal mild severe
#> (Intercept) 2.170579 0.25808932 -2.4286681
#> let -0.576919 -0.08919657 0.6661155
#>
#> , , 8
#>
#> normal mild severe
#> (Intercept) 2.0916309 0.3866929 -2.4783238
#> let -0.5559354 -0.1232739 0.6792092
#>