[Gmm-commits] r72 - pkg/gmm/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Apr 18 01:13:45 CEST 2013
Author: chaussep
Date: 2013-04-18 01:13:45 +0200 (Thu, 18 Apr 2013)
New Revision: 72
Modified:
pkg/gmm/R/Methods.gmm.R
Log:
Fixed an error message with just identified tsls
Modified: pkg/gmm/R/Methods.gmm.R
===================================================================
--- pkg/gmm/R/Methods.gmm.R 2013-04-03 11:28:22 UTC (rev 71)
+++ pkg/gmm/R/Methods.gmm.R 2013-04-17 23:13:45 UTC (rev 72)
@@ -52,34 +52,43 @@
ans <- summary.gmm(object)
ans$met <- paste(ans$met, "(Meat type = ", attr(object$vcov, "vcovType"), ")",sep="")
k <- object$dat$k
- fstat <- vector()
- fstat[1] <- object$fsRes[[1]]$fstatistic[1]
- df1 <- object$fsRes[[1]]$fstatistic[2]
- df2 <- object$fsRes[[1]]$fstatistic[3]
- for (i in 2:k)
- fstat[i] <- object$fsRes[[i]]$fstatistic[1]
- pvfstat <- 1-pf(fstat,df1, df2)
- names(fstat) <- colnames(object$dat$x)[(object$dat$ny+1):(object$dat$ny+k)]
- ans$fstatistic <- list(fstat = fstat, pvfstat = pvfstat, df1 = df1, df2 = df2)
+ if (!is.null(object$fsRes))
+ {
+ fstat <- vector()
+ fstat[1] <- object$fsRes[[1]]$fstatistic[1]
+ df1 <- object$fsRes[[1]]$fstatistic[2]
+ df2 <- object$fsRes[[1]]$fstatistic[3]
+ for (i in 2:k)
+ fstat[i] <- object$fsRes[[i]]$fstatistic[1]
+ pvfstat <- 1-pf(fstat,df1, df2)
+ names(fstat) <- colnames(object$dat$x)[(object$dat$ny+1):(object$dat$ny+k)]
+ ans$fstatistic <- list(fstat = fstat, pvfstat = pvfstat, df1 = df1, df2 = df2)
+ }
ans$specMod <- object$specMod
class(ans) <- "summary.tsls"
return(ans)
}
+
print.summary.tsls <- function(x, digits = 5, ...)
{
print.summary.gmm(x,digits)
- cat("\n First stage F-statistics: \n")
- if(names(x$fstatistic$fstat)[1]=="(Intercept)")
- start=2
- else
- start=1
- for (i in start:length(x$fstatistic$fstat))
- cat(names(x$fstatistic$fstat)[i],
- ": F(",x$fstatistic$df1,", ",x$fstatistic$df2,") = ",x$fstatistic$fstat[i],
- " (P-Vavue = ",x$fstatistic$pvfstat[i],")\n")
-
+ if (!is.null(x$fstatistic))
+ {
+ cat("\n First stage F-statistics: \n")
+ if(names(x$fstatistic$fstat)[1]=="(Intercept)")
+ start=2
+ else
+ start=1
+ for (i in start:length(x$fstatistic$fstat))
+ cat(names(x$fstatistic$fstat)[i],
+ ": F(",x$fstatistic$df1,", ",x$fstatistic$df2,") = ",x$fstatistic$fstat[i],
+ " (P-Vavue = ",x$fstatistic$pvfstat[i],")\n")
+ } else {
+ cat("\n No first stage F-statistics (just identified model)\n")
+ }
}
+
print.summary.gmm <- function(x, digits = 5, ...)
{
cat("\nCall:\n")
More information about the Gmm-commits
mailing list