📄 multinom.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Fit Multinomial Log-linear Models</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../R.css">
</head><body>
<table width="100%" summary="page for multinom {nnet}"><tr><td>multinom {nnet}</td><td align="right">R Documentation</td></tr></table>
<h2>Fit Multinomial Log-linear Models</h2>
<h3>Description</h3>
<p>
Fits multinomial log-linear models via neural networks.
</p>
<h3>Usage</h3>
<pre>
multinom(formula, data, weights, subset, na.action,
contrasts = NULL, Hess = FALSE, summ = 0, censored = FALSE,
model = FALSE, ...)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>formula</code></td>
<td>
a formula expression as for regression models, of the form
<code>response ~ predictors</code>. The response should be a factor or a
matrix with K columns, which will be interpreted as counts for each of
K classes.
A log-linear model is fitted, with coefficients zero for the first
class. An offset can be included: it should be a numeric matrix with K columns
if the response is either a matrix with K columns or a factor with K > 2
classes, or a numeric vector for a response factor with 2 levels.
See the documentation of <code><a href="../../stats/html/formula.html">formula</a>()</code> for other details.
</td></tr>
<tr valign="top"><td><code>data</code></td>
<td>
an optional data frame in which to interpret the variables occurring
in <code>formula</code>.
</td></tr>
<tr valign="top"><td><code>weights</code></td>
<td>
optional case weights in fitting.
</td></tr>
<tr valign="top"><td><code>subset</code></td>
<td>
expression saying which subset of the rows of the data should be used
in the fit. All observations are included by default.
</td></tr>
<tr valign="top"><td><code>na.action</code></td>
<td>
a function to filter missing data.
</td></tr>
<tr valign="top"><td><code>contrasts</code></td>
<td>
a list of contrasts to be used for some or all of
the factors appearing as variables in the model formula.
</td></tr>
<tr valign="top"><td><code>Hess</code></td>
<td>
logical for whether the Hessian (the observed/expected information matrix)
should be returned.
</td></tr>
<tr valign="top"><td><code>summ</code></td>
<td>
integer; if non-zero summarize by deleting duplicate rows and adjust weights.
Methods 1 and 2 differ in speed (2 uses <code>C</code>); method 3 also combines rows
with the same X and different Y, which changes the baseline for the
deviance.
</td></tr>
<tr valign="top"><td><code>censored</code></td>
<td>
If Y is a matrix with <code>K > 2</code> columns, interpret the entries as one
for possible classes, zero for impossible classes, rather than as
counts.
</td></tr>
<tr valign="top"><td><code>model</code></td>
<td>
logical. If true, the model frame is saved as component <code>model</code>
of the returned object.
</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
additional arguments for <code>nnet</code>
</td></tr>
</table>
<h3>Details</h3>
<p>
<code>multinom</code> calls <code><a href="nnet.html">nnet</a></code>. The variables on the rhs of
the formula should be roughly scaled to [0,1] or the fit will be slow
or may not converge at all.
</p>
<h3>Value</h3>
<p>
A <code>nnet</code> object with additional components:
</p>
<table summary="R argblock">
<tr valign="top"><td><code>deviance</code></td>
<td>
the residual deviance, compared to the full saturated model (that
explains individual observations exactly). Also, minus twice log-likelihood.
</td></tr>
<tr valign="top"><td><code>edf</code></td>
<td>
the (effective) number of degrees of freedom used by the model
</td></tr>
<tr valign="top"><td><code>AIC</code></td>
<td>
the AIC for this fit.
</td></tr>
<tr valign="top"><td><code>Hessian</code></td>
<td>
(if <code>Hess</code> is true).
</td></tr>
<tr valign="top"><td><code>model</code></td>
<td>
(if <code>model</code> is true).
</td></tr>
</table>
<h3>References</h3>
<p>
Venables, W. N. and Ripley, B. D. (2002)
<EM>Modern Applied Statistics with S.</EM> Fourth edition. Springer.
</p>
<h3>See Also</h3>
<p>
<code><a href="nnet.html">nnet</a></code>
</p>
<h3>Examples</h3>
<pre>
options(contrasts = c("contr.treatment", "contr.poly"))
library(MASS)
example(birthwt)
(bwt.mu <- multinom(low ~ ., bwt))
## Not run: Call:
multinom(formula = low ~ ., data = bwt)
Coefficients:
(Intercept) age lwt raceblack raceother
0.823477 -0.03724311 -0.01565475 1.192371 0.7406606
smoke ptd ht ui ftv1 ftv2+
0.7555234 1.343648 1.913213 0.6802007 -0.4363238 0.1789888
Residual Deviance: 195.4755
AIC: 217.4755
## End(Not run)
</pre>
<hr><div align="center">[Package <em>nnet</em> version 7.2-44 <a href="00Index.html">Index]</a></div>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -