Open MatthieuStigler opened 5 years ago
See code:
library(texreg) library(tsDyn) lm <- lm(freeny) screenreg(lm) data(barry) ve <- VECM(barry, lag=1) var <- lineVar(barry, lag=1) # tsDyn:::toMlm.nlVar(ve) %>% # screenreg() # getMethod("extract", "lm") # model <- ve extract.VECM <- function (model, ...) { .local <- function (model, include.nobs = TRUE, include.aic = TRUE, include.bic = TRUE, ...) { s <- summary(model, ...) sCo <- s$coefMat # names <- rownames(s$coef) co <- sCo[,1] names <- names(co) se <- sCo[,2] pval <- sCo[,4] # rs <- s$r.squared # adj <- s$adj.r.squared n <- model$T gof <- numeric() gof.names <- character() gof.decimal <- logical() if (include.nobs == TRUE) { gof <- c(gof, n) gof.names <- c(gof.names, "Num. Time obs.") gof.decimal <- c(gof.decimal, FALSE) } if (include.aic == TRUE ) { aic <- AIC(model) gof <- c(gof, aic) gof.names <- c(gof.names, "AIC") gof.decimal <- c(gof.decimal, TRUE) } if (include.bic == TRUE ) { bic <- BIC(model) gof <- c(gof, bic) gof.names <- c(gof.names, "BIC") gof.decimal <- c(gof.decimal, TRUE) } tr <- createTexreg(coef.names = names, coef = co, se = se, pvalues = pval, gof.names = gof.names, gof = gof, gof.decimal = gof.decimal) return(tr) } .local(model, ...) } setMethod("extract", signature = className("VECM", "tsDyn"), definition = extract.VECM) setMethod("extract", signature = className("VAR", "tsDyn"), definition = extract.VECM) screenreg(ve) screenreg(var) screenreg(list(var, ve))
See code: