EVOLUTION-MANAGER
Edit File: model.extract.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Extract Components from a Model Frame</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for model.extract {stats}"><tr><td>model.extract {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Extract Components from a Model Frame</h2> <h3>Description</h3> <p>Returns the response, offset, subset, weights or other special components of a model frame passed as optional arguments to <code><a href="model.frame.html">model.frame</a></code>. </p> <h3>Usage</h3> <pre> model.extract(frame, component) model.offset(x) model.response(data, type = "any") model.weights(x) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>frame, x, data</code></td> <td> <p>A model frame.</p> </td></tr> <tr valign="top"><td><code>component</code></td> <td> <p>literal character string or name. The name of a component to extract, such as <code>"weights"</code>, <code>"subset"</code>.</p> </td></tr> <tr valign="top"><td><code>type</code></td> <td> <p>One of <code>"any"</code>, <code>"numeric"</code>, <code>"double"</code>. Using either of latter two coerces the result to have storage mode <code>"double"</code>.</p> </td></tr> </table> <h3>Details</h3> <p><code>model.extract</code> is provided for compatibility with S, which does not have the more specific functions. It is also useful to extract e.g. the <code>etastart</code> and <code>mustart</code> components of a <code><a href="glm.html">glm</a></code> fit. </p> <p><code>model.offset</code> and <code>model.response</code> are equivalent to <code>model.extract(, "offset")</code> and <code>model.extract(, "response")</code> respectively. <code>model.offset</code> sums any terms specified by <code><a href="offset.html">offset</a></code> terms in the formula or by <code>offset</code> arguments in the call producing the model frame: it does check that the offset is numeric. </p> <p><code>model.weights</code> is slightly different from <code>model.frame(, "weights")</code> in not naming the vector it returns. </p> <h3>Value</h3> <p>The specified component of the model frame, usually a vector.</p> <h3>See Also</h3> <p><code><a href="model.frame.html">model.frame</a></code>, <code><a href="offset.html">offset</a></code></p> <h3>Examples</h3> <pre> a <- model.frame(cbind(ncases,ncontrols) ~ agegp + tobgp + alcgp, data = esoph) model.extract(a, "response") stopifnot(model.extract(a, "response") == model.response(a)) a <- model.frame(ncases/(ncases+ncontrols) ~ agegp + tobgp + alcgp, data = esoph, weights = ncases+ncontrols) model.response(a) model.extract(a, "weights") a <- model.frame(cbind(ncases,ncontrols) ~ agegp, something = tobgp, data = esoph) names(a) stopifnot(model.extract(a, "something") == esoph$tobgp) </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>