ordinal (version 2019.12-10)

clm.fit: Fit Cumulative Link Models

Description

A direct fitter of cumulative link models.

Usage

clm.fit(y, ...)

# S3 method for default clm.fit(y, ...)

# S3 method for factor clm.fit(y, X, S, N, weights = rep(1, nrow(X)), offset = rep(0, nrow(X)), S.offset = rep(0, nrow(X)), control = list(), start, doFit=TRUE, link = c("logit", "probit", "cloglog", "loglog", "cauchit", "Aranda-Ordaz", "log-gamma"), threshold = c("flexible", "symmetric", "symmetric2", "equidistant"), ...)

Value

A list with the following components:

aliased, alpha, coefficients, cond.H, convergence, df.residual, edf, fitted.values, gradient, Hessian, logLik, maxGradient, message, n, niter, nobs, tJac, vcov

and optionally

beta, zeta

These components are documented in clm.

Arguments

y

for the default method a list of model components. For the factor method the response variable; a factor, preferably and ordered factor.

X, S, N

optional design matrices for the regression parameters, scale parameters and nominal parameters respectively.

weights

optional case weights.

offset

an optional offset.

S.offset

an optional offset for the scale part of the model.

control

a list of control parameters, optionally a call to clm.control.

start

an optional list of starting values of the form c(alpha, beta, zeta) for the thresholds and nominal effects (alpha), regression parameters (beta) and scale parameters (zeta).

doFit

logical for whether the model should be fit or the model environment should be returned.

link

the link function.

threshold

the threshold structure, see further at clm.

...

currently not used.

Author

Rune Haubo B Christensen

Details

This function does almost the same thing that clm does: it fits a cumulative link model. The main differences are that clm.fit does not setup design matrices from formulae and only does minimal post processing after parameter estimation.

Compared to clm, clm.fit does little to warn the user of any problems with data or model. However, clm.fit will attempt to identify column rank defecient designs. Any unidentified parameters are indicated in the aliased component of the fit.

clm.fit.factor is not able to check if all thresholds are increasing when nominal effects are specified since it needs access to the terms object for the nominal model. If the terms object for the nominal model (nom.terms) is included in y, the default method is able to chech if all thresholds are increasing.

See Also

clm

Examples

Run this code

## A simple example:
fm1 <- clm(rating ~ contact + temp, data=wine)
summary(fm1)
## get the model frame containing y and X:
mf1 <- update(fm1, method="design")
names(mf1)
res <- clm.fit(mf1$y, mf1$X) ## invoking the factor method
stopifnot(all.equal(coef(res), coef(fm1)))
names(res)

## Fitting with the default method:
mf1$control$method <- "Newton"
res2 <- clm.fit(mf1)
stopifnot(all.equal(coef(res2), coef(fm1)))

Run the code above in your browser using DataCamp Workspace