R/predict.linmod.R

predict.linmod <-
function(object, newdata=NULL, ...){
if(is.null(newdata))
y <- fitted(object)
else{
if(!is.null(object$formula)){
## model has been fitted using formula interface
x <- model.matrix(object$formula, newdata)
}
else{
x <- newdata
}
y <- as.vector(x %*% coef(object))
}
y
}
rcastaneda2/sfunction3 documentation built on May 27, 2019, 3:02 a.m.