summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorSuraj Yerramilli2015-09-09 16:47:57 +0530
committerSuraj Yerramilli2015-09-09 16:47:57 +0530
commita932940a29554c35f68ced4f8ae9d1ebdf7560ab (patch)
treef0bd08cc79c801684d2de3fbfcc9c1d275d3078b /R
parent701b57741bb1da6b66723ff04f4e94e32e8e5966 (diff)
downloadSysID-R-code-a932940a29554c35f68ced4f8ae9d1ebdf7560ab.tar.gz
SysID-R-code-a932940a29554c35f68ced4f8ae9d1ebdf7560ab.tar.bz2
SysID-R-code-a932940a29554c35f68ced4f8ae9d1ebdf7560ab.zip
Added MSE and FPE methods to the estPoly function
Diffstat (limited to 'R')
-rw-r--r--R/estpoly.R12
1 files changed, 9 insertions, 3 deletions
diff --git a/R/estpoly.R b/R/estpoly.R
index 7694a9a..4d63e02 100644
--- a/R/estpoly.R
+++ b/R/estpoly.R
@@ -26,8 +26,13 @@ summary.estPoly <- function(object)
for(j in (na+1):nrow(TAB)) {
rownames(TAB)[j] <- paste("b",j-na-1+nk,sep="")
}
- res <- list(call=object$call,coefficients=TAB,sigma=object$sigma,
- df=object$df)
+ ek <- as.matrix(resid(model))
+ N <- nrow(ek); np <- nrow(TAB)
+ mse <- t(ek)%*%ek/N
+ fpe <- det(mse)*(1+np/N)/(1-np/N)
+
+ res <- list(call=object$call,coefficients=TAB,mse = mse,
+ fpe=fpe,df=object$df)
class(res) <- "summary.estPoly"
res
}
@@ -38,7 +43,8 @@ print.summary.estPoly <- function(object){
cat("Call: ");print(object$call);cat("\n\n")
print(coef(object))
- cat(paste("\nsigma:",format(object$sigma,digits=4)))
+ cat(paste("\nMSE:",format(object$mse,digits=4),
+ "\tFPE:",format(object$fpe,digits=4)))
cat(paste("\nDoF:",object$df))
}