EVOLUTION-MANAGER
Edit File: update.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: Update and Re-fit a Model Call</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 update {stats}"><tr><td>update {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Update and Re-fit a Model Call</h2> <h3>Description</h3> <p><code>update</code> will update and (by default) re-fit a model. It does this by extracting the call stored in the object, updating the call and (by default) evaluating that call. Sometimes it is useful to call <code>update</code> with only one argument, for example if the data frame has been corrected. </p> <p>“Extracting the call” in <code>update()</code> and similar functions uses <code>getCall()</code> which itself is a (S3) generic function with a default method that simply gets <code>x$call</code>. </p> <p>Because of this, <code>update()</code> will often work (via its default method) on new model classes, either automatically, or by providing a simple <code>getCall()</code> method for that class. </p> <h3>Usage</h3> <pre> update(object, ...) ## Default S3 method: update(object, formula., ..., evaluate = TRUE) getCall(x, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>object, x</code></td> <td> <p>An existing fit from a model function such as <code>lm</code>, <code>glm</code> and many others.</p> </td></tr> <tr valign="top"><td><code>formula.</code></td> <td> <p>Changes to the formula – see <code>update.formula</code> for details.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Additional arguments to the call, or arguments with changed values. Use <code>name = NULL</code> to remove the argument <code>name</code>.</p> </td></tr> <tr valign="top"><td><code>evaluate</code></td> <td> <p>If true evaluate the new call else return the call.</p> </td></tr> </table> <h3>Value</h3> <p>If <code>evaluate = TRUE</code> the fitted object, otherwise the updated call. </p> <h3>References</h3> <p>Chambers, J. M. (1992) <em>Linear models.</em> Chapter 4 of <em>Statistical Models in S</em> eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole. </p> <h3>See Also</h3> <p><code><a href="update.formula.html">update.formula</a></code> </p> <h3>Examples</h3> <pre> oldcon <- options(contrasts = c("contr.treatment", "contr.poly")) ## Annette Dobson (1990) "An Introduction to Generalized Linear Models". ## Page 9: Plant Weight Data. ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group <- gl(2, 10, 20, labels = c("Ctl", "Trt")) weight <- c(ctl, trt) lm.D9 <- lm(weight ~ group) lm.D9 summary(lm.D90 <- update(lm.D9, . ~ . - 1)) options(contrasts = c("contr.helmert", "contr.poly")) update(lm.D9) getCall(lm.D90) # "through the origin" options(oldcon) </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>