summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuraj Yerramilli2016-01-02 22:39:05 +0530
committerSuraj Yerramilli2016-01-02 22:39:05 +0530
commite30ed0751ced63a1ef6e4ada8683e27b3dee74b4 (patch)
treeea3e8e7798efd37ea2ac7ec98bccc744f5d6fc97
parent35c54adefaf95853e2fd16e8b27ff4ca3a812b29 (diff)
downloadSysID-R-code-e30ed0751ced63a1ef6e4ada8683e27b3dee74b4.tar.gz
SysID-R-code-e30ed0751ced63a1ef6e4ada8683e27b3dee74b4.tar.bz2
SysID-R-code-e30ed0751ced63a1ef6e4ada8683e27b3dee74b4.zip
generating print characteristics
-rw-r--r--R/estpoly.R15
1 files changed, 11 insertions, 4 deletions
diff --git a/R/estpoly.R b/R/estpoly.R
index d38a9d3..596b98c 100644
--- a/R/estpoly.R
+++ b/R/estpoly.R
@@ -40,11 +40,16 @@ summary.estpoly <- function(x)
N <- nrow(ek); np <- nrow(params)
# fit characteristics
- mse <- t(ek)%*%ek/N
- fpe <- det(mse)*(1+np/N)/(1-np/N)
+ mse <- det(t(ek)%*%ek)/N
+ fpe <- mse*(1+np/N)/(1-np/N)
nrmse <- 1 - sqrt(sum(ek^2))/sqrt(sum((y-mean(y))^2))
+ AIC <- N*log(mse) + 2*np + N*dim(matrix(y))[2]*(log(2*pi)+1)
+ AICc <- AIC*2*np*(np+1)/(N-np-1)
+ nAIC <- log(mse) + 2*np/N
+ BIC <- N*log(mse) + N*dim(matrix(y))[2]*(log(2*pi)+1) + np*log(N)
- report <- list(fit=list(N=N,mse=mse,fpe=fpe,fitper = nrmse),params=params)
+ report <- list(fit=list(mse=mse,fpe=fpe,fitper = nrmse*100,AIC=AIC,AICc=AICc,
+ nAIC=nAIC,BIC=BIC),params=params)
res <- list(model=model,report=report)
class(res) <- "summary.estpoly"
res
@@ -52,8 +57,10 @@ summary.estpoly <- function(x)
#' @export
print.summary.estpoly <- function(x,...){
+ dots <- list(...)
+ dig <- if(is.null(dots$digits)) 3 else dot$digits
print(x$model,se=x$report$params[,2],...)
- print(x$report$fit,...)
+ print(x$report$fit,digits=dig,...)
}
#' @export