Description Usage Arguments Value Author(s) Examples
Returns the residuals from an object of class modelObjFit.
1 2 |
object |
an object of class modelObjFit containing the regression object from which residuals are to be retrieved. |
... |
ignored |
If residuals()
is defined for the regression method
used to obtain parameter estimate, returns the
residuals as defined by the regression method.
If method does not exist, a warning messages is printed.
Shannon T. Holloway <sthollow@ncsu.edu>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #----------------------------------------------------#
# Generate data
#----------------------------------------------------#
X <- matrix(rnorm(1000,0,1),
ncol=4,
dimnames=list(NULL,c("X1","X2","X3","X4")))
Y <- X %*% c(0.1, 0.2, 0.3, 0.4) + rnorm(250)
X <- data.frame(X)
#----------------------------------------------------#
# Create modeling object using a formula
#----------------------------------------------------#
mo <- buildModelObj(model = Y ~ X1 + X2 + X3 + X4,
solver.method = 'lm')
#----------------------------------------------------#
# Fit model
#----------------------------------------------------#
fit.obj <- fit(object=mo, data=X, response=Y)
res <- residuals(fit.obj)
head(res)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.