📄 theta.md.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Estimate theta of the Negative Binomial</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 theta.md {MASS}"><tr><td>theta.md {MASS}</td><td align="right">R Documentation</td></tr></table>
<h2>Estimate theta of the Negative Binomial</h2>
<h3>Description</h3>
<p>
Given the estimated mean vector, estimate <code>theta</code> of the
Negative Binomial Distribution.
</p>
<h3>Usage</h3>
<pre>
theta.md(y, mu, dfr, weights, limit = 20, eps = .Machine$double.eps^0.25)
theta.ml(y, mu, n, weights, limit = 10, eps = .Machine$double.eps^0.25,
trace = FALSE)
theta.mm(y, mu, dfr, weights, limit = 10, eps = .Machine$double.eps^0.25)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>y</code></td>
<td>
Vector of observed values from the Negative Binomial.
</td></tr>
<tr valign="top"><td><code>mu</code></td>
<td>
Estimated mean vector.
</td></tr>
<tr valign="top"><td><code>n</code></td>
<td>
Number of data points (defaults to the sum of <code>weights</code>)
</td></tr>
<tr valign="top"><td><code>dfr</code></td>
<td>
Residual degrees of freedom (assuming <code>theta</code> known). For
a weighted fit this is the sum of the weights minus the number of
fitted parameters.
</td></tr>
<tr valign="top"><td><code>weights</code></td>
<td>
Case weights. If missing, taken as 1.
</td></tr>
<tr valign="top"><td><code>limit</code></td>
<td>
Limit on the number of iterations.
</td></tr>
<tr valign="top"><td><code>eps</code></td>
<td>
Tolerance to determine convergence.
</td></tr>
<tr valign="top"><td><code>trace</code></td>
<td>
logical: should iteration progress be printed?
</td></tr>
</table>
<h3>Details</h3>
<p>
<code>theta.md</code> estimates by equating the deviance to the residual
degrees of freedom, an analogue of a moment estimator.
</p>
<p>
<code>theta.ml</code> uses maximum likelihood.
</p>
<p>
<code>theta.mm</code> calculates the moment estimator of <code>theta</code> by
equating the Pearson chi-square
<i>sum((y-μ)^2/(μ+μ^2/theta))</i> to the residual
degrees of freedom.
</p>
<h3>Value</h3>
<p>
The required estimate of <code>theta</code>, as a scalar.
For <code>theta.ml</code>, the standard error is given as attribute <code>"SE"</code>.</p>
<h3>See Also</h3>
<p>
<code><a href="glm.nb.html">glm.nb</a></code>
</p>
<h3>Examples</h3>
<pre>
quine.nb <- glm.nb(Days ~ .^2, data = quine)
theta.md(quine$Days, fitted(quine.nb), dfr = df.residual(quine.nb))
theta.ml(quine$Days, fitted(quine.nb))
theta.mm(quine$Days, fitted(quine.nb), dfr = df.residual(quine.nb))
## weighted example
yeast <- data.frame(cbind(numbers = 0:5, fr = c(213, 128, 37, 18, 3, 1)))
fit <- glm.nb(numbers ~ 1, weights = fr, data = yeast)
summary(fit)
attach(yeast)
mu <- fitted(fit)
theta.md(numbers, mu, dfr = 399, weights = fr)
theta.ml(numbers, mu, weights = fr)
theta.mm(numbers, mu, dfr = 399, weights = fr)
detach()
</pre>
<hr><div align="center">[Package <em>MASS</em> version 7.2-44 <a href="00Index.html">Index]</a></div>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -