EVOLUTION-MANAGER
Edit File: lsfit.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: Find the Least Squares Fit</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 lsfit {stats}"><tr><td>lsfit {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Find the Least Squares Fit</h2> <h3>Description</h3> <p>The least squares estimate of <b><i>b</i></b> in the model </p> <p style="text-align: center;"><i>y = X b + e</i></p> <p>is found. </p> <h3>Usage</h3> <pre> lsfit(x, y, wt = NULL, intercept = TRUE, tolerance = 1e-07, yname = NULL) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>a matrix whose rows correspond to cases and whose columns correspond to variables.</p> </td></tr> <tr valign="top"><td><code>y</code></td> <td> <p>the responses, possibly a matrix if you want to fit multiple left hand sides.</p> </td></tr> <tr valign="top"><td><code>wt</code></td> <td> <p>an optional vector of weights for performing weighted least squares.</p> </td></tr> <tr valign="top"><td><code>intercept</code></td> <td> <p>whether or not an intercept term should be used.</p> </td></tr> <tr valign="top"><td><code>tolerance</code></td> <td> <p>the tolerance to be used in the matrix decomposition.</p> </td></tr> <tr valign="top"><td><code>yname</code></td> <td> <p>names to be used for the response variables.</p> </td></tr> </table> <h3>Details</h3> <p>If weights are specified then a weighted least squares is performed with the weight given to the <em>j</em>th case specified by the <em>j</em>th entry in <code>wt</code>. </p> <p>If any observation has a missing value in any field, that observation is removed before the analysis is carried out. This can be quite inefficient if there is a lot of missing data. </p> <p>The implementation is via a modification of the LINPACK subroutines which allow for multiple left-hand sides. </p> <h3>Value</h3> <p>A list with the following named components: </p> <table summary="R valueblock"> <tr valign="top"><td><code>coef</code></td> <td> <p>the least squares estimates of the coefficients in the model (<b><i>b</i></b> as stated above).</p> </td></tr> <tr valign="top"><td><code>residuals</code></td> <td> <p>residuals from the fit.</p> </td></tr> <tr valign="top"><td><code>intercept</code></td> <td> <p>indicates whether an intercept was fitted.</p> </td></tr> <tr valign="top"><td><code>qr</code></td> <td> <p>the QR decomposition of the design matrix.</p> </td></tr> </table> <h3>References</h3> <p>Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) <em>The New S Language</em>. Wadsworth & Brooks/Cole. </p> <h3>See Also</h3> <p><code><a href="lm.html">lm</a></code> which usually is preferable; <code><a href="ls.print.html">ls.print</a></code>, <code><a href="ls.diag.html">ls.diag</a></code>. </p> <h3>Examples</h3> <pre> ##-- Using the same data as the lm(.) example: lsD9 <- lsfit(x = unclass(gl(2, 10)), y = weight) ls.print(lsD9) </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>