prediction.frame {memisc} | R Documentation |
prediction.frame
produces a data frame that contains
the independent variables of a model together with model generated predictions.
## Default S3 method: prediction.frame(object,newdata=NULL,..., residuals=c("none", "deviance", "pearson", "working", "standardized", "studentized"))
object |
a model object from which predictions are generated. |
newdata |
an optional data frame for out-of-sample predictions. |
... |
further arguments passed to predict . |
residuals |
a character vector that specifies residuals that are added to the resulting data frame. |
A data frame.
lm1 <- lm(sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings) lm2 <- lm(sr ~ pop15 + pop75 + dpi + ddpi + pop15*dpi, data = LifeCycleSavings) str(prediction.frame(lm1)) str(prediction.frame(lm1, se.fit=TRUE)) str(prediction.frame(lm1, interval="prediction")) str(prediction.frame(lm1, type="terms")) str(prediction.frame(lm1, se.fit=TRUE, type="terms")) str(prediction.frame(lm1, se.fit=TRUE, type="terms", residuals="working")) str(prediction.frame(lm1, se.fit=TRUE, type="terms", residuals="deviance")) str(prediction.frame(lm2, se.fit=TRUE, type="terms", residuals="standardized")) berkeley <- aggregate(Table(Admit,Freq)~.,data=UCBAdmissions) berk2 <- glm(cbind(Admitted,Rejected)~Gender+Dept,data=berkeley,family="binomial") str(prediction.frame(berk2, se.fit=TRUE, type="terms", residuals="studentized"))