EVOLUTION-MANAGER
Edit File: predict.nls.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: Predicting from Nonlinear Least Squares Fits</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 predict.nls {stats}"><tr><td>predict.nls {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Predicting from Nonlinear Least Squares Fits</h2> <h3>Description</h3> <p><code>predict.nls</code> produces predicted values, obtained by evaluating the regression function in the frame <code>newdata</code>. If the logical <code>se.fit</code> is <code>TRUE</code>, standard errors of the predictions are calculated. If the numeric argument <code>scale</code> is set (with optional <code>df</code>), it is used as the residual standard deviation in the computation of the standard errors, otherwise this is extracted from the model fit. Setting <code>intervals</code> specifies computation of confidence or prediction (tolerance) intervals at the specified <code>level</code>. </p> <p>At present <code>se.fit</code> and <code>interval</code> are ignored. </p> <h3>Usage</h3> <pre> ## S3 method for class 'nls' predict(object, newdata , se.fit = FALSE, scale = NULL, df = Inf, interval = c("none", "confidence", "prediction"), level = 0.95, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>object</code></td> <td> <p>An object that inherits from class <code>nls</code>.</p> </td></tr> <tr valign="top"><td><code>newdata</code></td> <td> <p>A named list or data frame in which to look for variables with which to predict. If <code>newdata</code> is missing the fitted values at the original data points are returned.</p> </td></tr> <tr valign="top"><td><code>se.fit</code></td> <td> <p>A logical value indicating if the standard errors of the predictions should be calculated. Defaults to <code>FALSE</code>. At present this argument is ignored.</p> </td></tr> <tr valign="top"><td><code>scale</code></td> <td> <p>A numeric scalar. If it is set (with optional <code>df</code>), it is used as the residual standard deviation in the computation of the standard errors, otherwise this information is extracted from the model fit. At present this argument is ignored.</p> </td></tr> <tr valign="top"><td><code>df</code></td> <td> <p>A positive numeric scalar giving the number of degrees of freedom for the <code>scale</code> estimate. At present this argument is ignored.</p> </td></tr> <tr valign="top"><td><code>interval</code></td> <td> <p>A character string indicating if prediction intervals or a confidence interval on the mean responses are to be calculated. At present this argument is ignored.</p> </td></tr> <tr valign="top"><td><code>level</code></td> <td> <p>A numeric scalar between 0 and 1 giving the confidence level for the intervals (if any) to be calculated. At present this argument is ignored.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Additional optional arguments. At present no optional arguments are used.</p> </td></tr> </table> <h3>Value</h3> <p><code>predict.nls</code> produces a vector of predictions. When implemented, <code>interval</code> will produce a matrix of predictions and bounds with column names <code>fit</code>, <code>lwr</code>, and <code>upr</code>. When implemented, if <code>se.fit</code> is <code>TRUE</code>, a list with the following components will be returned: </p> <table summary="R valueblock"> <tr valign="top"><td><code>fit</code></td> <td> <p>vector or matrix as above</p> </td></tr> <tr valign="top"><td><code>se.fit</code></td> <td> <p>standard error of predictions</p> </td></tr> <tr valign="top"><td><code>residual.scale</code></td> <td> <p>residual standard deviations</p> </td></tr> <tr valign="top"><td><code>df</code></td> <td> <p>degrees of freedom for residual</p> </td></tr> </table> <h3>Note</h3> <p>Variables are first looked for in <code>newdata</code> and then searched for in the usual way (which will include the environment of the formula used in the fit). A warning will be given if the variables found are not of the same length as those in <code>newdata</code> if it was supplied. </p> <h3>See Also</h3> <p>The model fitting function <code><a href="nls.html">nls</a></code>, <code><a href="predict.html">predict</a></code>. </p> <h3>Examples</h3> <pre> require(graphics) fm <- nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD) predict(fm) # fitted values at observed times ## Form data plot and smooth line for the predictions opar <- par(las = 1) plot(demand ~ Time, data = BOD, col = 4, main = "BOD data and fitted first-order curve", xlim = c(0,7), ylim = c(0, 20) ) tt <- seq(0, 8, length = 101) lines(tt, predict(fm, list(Time = tt))) par(opar) </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>