as.lm | R Documentation |
This functions is a modified version of the code
available at the nls2
package on github
https://github.com/ggrothendieck/nls2. This function is no
longer available in the current version of nls2
package.
as.lm(object, ...) ## S3 method for class 'nls' as.lm(object, ...)
object |
An object of class |
... |
Currently not used. |
This function is useful to get the residuals plot for the
fitted nls model. The dependence on the as.proto.list
function in the proto
package was removed (also this
function no longer exists). Thanks for the original author of
this function G. Grothendieck.
This function returns an object of class lm
created
from the nls
object. The linear model design matrix used
is the the partial derivatives of the nls
model function
with relation to the model parameters, i.e. the gradient matrix.
Walmes Zeviani, walmes@ufr.br
# An simple nls fit. n0 <- nls(dist ~ A + B * speed^C, data = cars, start = c(A = 0, B = 1, C = 1)) summary(n0) # The results. plot(dist ~ speed, data = cars) with(as.list(coef(n0)), { curve(A + B * speed^C, xname = "speed", add = TRUE) }) # Residual analysis. par(mfrow = c(2, 2)) plot(as.lm(n0)) layout(1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.