| tulpa_ordinal | R Documentation |
Fits a proportional-odds cumulative-logit model for an ordered factor
response: P(y <= j | x) = plogis(c_j - x'beta) with ordered cutpoints
c_1 < ... < c_{K-1}. The penalized mode (a ridge prior on the coefficients
and cutpoints) is found by L-BFGS and summarized by a Laplace approximation.
There is no separate intercept – the cutpoints carry the baseline levels.
tulpa_ordinal(
formula,
data,
link = c("logit", "probit"),
beta_prior = .tulpa_default_beta_prior("ordinal"),
cut_prior_sd = 10,
control = list()
)
## S3 method for class 'tulpa_ordinal'
coef(object, ...)
## S3 method for class 'tulpa_ordinal'
print(x, ...)
formula |
Model formula; the response must be an ordered (or coercible)
factor with >= 3 levels, each observed at least once. An intercept in
|
data |
A data frame. |
link |
Cumulative link: |
beta_prior |
Fixed-effect prior as |
cut_prior_sd |
SD of the mean-zero Gaussian ridge prior on the cutpoint parameters (default 10). |
control |
List of numerical knobs: |
object |
A |
... |
Ignored. |
x |
A |
A tulpa_fit (subclass tulpa_ordinal) with coefficients
(covariate effects) and cutpoints at the posterior mode, draws (the
Laplace Gaussian mapped to ordered cutpoints), log_marginal, levels.
The draws are the posterior coef(), vcov(), summary.tulpa_fit() and
confint() report; coef() omits the cutpoints, as MASS::polr does.
coef() returns the covariate effects without the cutpoints, as
MASS::polr() omits its zeta; vcov() and summary() keep them.
tulpa_multinomial() for the nominal (unordered) case.
set.seed(1)
n <- 400L; x <- rnorm(n)
cuts <- c(-1, 0.5, 2); eta <- 0.8 * x
Fm <- plogis(outer(-eta, cuts, "+")); P <- cbind(Fm, 1) - cbind(0, Fm)
y <- ordered(apply(P, 1, function(pr) sample.int(4L, 1L, prob = pr)))
fit <- tulpa_ordinal(y ~ x, data = data.frame(y = y, x = x))
fit$coefficients; fit$cutpoints
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.