Description Usage Arguments Details Value Author(s) Examples
Fits cumulative link models (CLMs) such as the propotional odds model. The model allows for various link functions and structured thresholds that restricts the thresholds or cut-points to be e.g., equidistant or symmetrically arranged around the central threshold(s). Nominal effects (partial proportional odds with the logit link) are also allowed. A modified Newton algorithm is used to optimize the likelihood function.
1 2 3 4 |
formula |
a formula expression as for regression models, of the form
|
scale |
an optional formula expression, of the form
|
nominal |
an optional formula of the form |
data |
an optional data frame in which to interpret the variables occurring in the formulas. |
weights |
optional case weights in fitting. Defaults to 1. Negative weights are not allowed. |
start |
initial values for the parameters in the format
|
subset |
expression saying which subset of the rows of the data should be used in the fit. All observations are included by default. |
doFit |
logical for whether the model should be fit or the model environment should be returned. |
na.action |
a function to filter missing data. Applies to terms in all three formulae. |
contrasts |
a list of contrasts to be used for some or all of the factors appearing as variables in the model formula. |
model |
logical for whether the model frame should be part of the returned object. |
control |
a list of control parameters passed on to
|
link |
link function, i.e., the type of location-scale distribution
assumed for the latent distribution. The default |
threshold |
specifies a potential structure for the thresholds
(cut-points). |
... |
additional arguments are passed on to |
This is a new (as of August 2011) improved implementation of CLMs. The
old implementation is available in clm2
, but will
probably be removed at some point.
There are methods for the standard model-fitting functions, including
summary
,
anova
,
model.frame
,
model.matrix
,
drop1
,
dropterm
,
step
,
stepAIC
,
extractAIC
,
AIC
,
coef
,
nobs
,
profile
,
confint
,
vcov
and
slice
.
If doFit = FALSE
the result is an environment
representing the model ready to be optimized.
If doFit = TRUE
the result is an
object of class "clm"
with the components listed below.
Note that some components are only present if scale
and
nominal
are used.
aliased |
list of length 3 or less with components |
alpha |
a vector of threshold parameters. |
alpha.mat |
(where relevant) a table ( |
beta |
(where relevant) a vector of regression parameters. |
call |
the mathed call. |
coefficients |
a vector of coefficients of the form
|
cond.H |
Condition number of the Hessian matrix at the optimum (i.e. the ratio of the largest to the smallest eigenvalue). |
contrasts |
(where relevant) the contrasts used for the
|
control |
List of control parameters as generated by |
convergence |
convergence code where 0 indicates successful convergence; 1 indicates the iteration limit was reached before convergence; 2 indicates the step factor was reduced below minimum before convergence was reached; 3 indicates that thresholds are not increasing (only possible with nominal effects). |
edf |
the estimated degrees of freedom, i.e., the number of parameters in the model fit. |
fitted.values |
the fitted probabilities. |
gradient |
a vector of gradients for the coefficients at the estimated optimum. |
Hessian |
the Hessian matrix for the parameters at the estimated optimum. |
info |
a table of basic model information for printing. |
link |
character, the link function used. |
logLik |
the value of the log-likelihood at the estimated optimum. |
maxGradient |
the maximum absolute gradient, i.e.,
|
model |
if requested (the default), the
|
n |
the number of observations counted as |
na.action |
(where relevant) information returned by
|
nobs |
the number of observations counted as |
nom.contrasts |
(where relevant) the contrasts used for the
|
nom.terms |
(where relevant) the terms object for the
|
nom.xlevels |
(where relevant) a record of the levels of the
factors used in fitting for the |
start |
the parameter values at which the optimization has
started. An attribute |
S.contrasts |
(where relevant) the contrasts used for the
|
S.terms |
(where relevant) the terms object for the |
S.xlevels |
(where relevant) a record of the levels of the
factors used in fitting for the |
terms |
the terms object for the |
Theta |
(where relevant) a table ( |
threshold |
character, the threshold structure used. |
tJac |
the transpose of the Jacobian for the threshold structure. |
xlevels |
(where relevant) a record of the levels of the factors
used in fitting for the |
y.levels |
the levels of the response variable after removing levels for which all weights are zero. |
zeta |
(where relevant) a vector of scale regression parameters. |
Rune Haubo B Christensen
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | fm1 <- clm(rating ~ temp * contact, data = wine)
fm1 ## print method
summary(fm1)
fm2 <- update(fm1, ~.-temp:contact)
anova(fm1, fm2)
drop1(fm1, test = "Chi")
add1(fm1, ~.+judge, test = "Chi")
fm2 <- step(fm1)
summary(fm2)
coef(fm1)
vcov(fm1)
AIC(fm1)
extractAIC(fm1)
logLik(fm1)
fitted(fm1)
confint(fm1) ## type = "profile"
confint(fm1, type = "Wald")
pr1 <- profile(fm1)
confint(pr1)
## plotting the profiles:
par(mfrow = c(2, 2))
plot(pr1, root = TRUE) ## check for linearity
par(mfrow = c(2, 2))
plot(pr1)
par(mfrow = c(2, 2))
plot(pr1, approx = TRUE)
par(mfrow = c(2, 2))
plot(pr1, Log = TRUE)
par(mfrow = c(2, 2))
plot(pr1, Log = TRUE, relative = FALSE)
## other link functions:
fm4.lgt <- update(fm1, link = "logit") ## default
fm4.prt <- update(fm1, link = "probit")
fm4.ll <- update(fm1, link = "loglog")
fm4.cll <- update(fm1, link = "cloglog")
fm4.cct <- update(fm1, link = "cauchit")
anova(fm4.lgt, fm4.prt, fm4.ll, fm4.cll, fm4.cct)
## structured thresholds:
fm5 <- update(fm1, threshold = "symmetric")
fm6 <- update(fm1, threshold = "equidistant")
anova(fm1, fm5, fm6)
## the slice methods:
slice.fm1 <- slice(fm1)
par(mfrow = c(3, 3))
plot(slice.fm1)
## see more at '?slice.clm'
## Another example:
fm.soup <- clm(SURENESS ~ PRODID, data = soup)
summary(fm.soup)
if(require(MASS)) { ## dropterm, addterm, stepAIC, housing
fm1 <- clm(rating ~ temp * contact, data = wine)
dropterm(fm1, test = "Chi")
addterm(fm1, ~.+judge, test = "Chi")
fm3 <- stepAIC(fm1)
summary(fm3)
## Example from MASS::polr:
fm1 <- clm(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
summary(fm1)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.