R/print.summary.hdglm.R

print.summary.hdglm <-
function (x, digits = max(3, getOption("digits") - 3),
              symbolic.cor = x$symbolic.cor,
      signif.stars= getOption("show.signif.stars"),...)
{
    cat("\nCall:\n", # S has ' ' instead of '\n'
    paste(deparse(x$call), sep="\n", collapse = "\n"), "\n\n", sep="")
    resid <- x$residuals
    df <- x$rank
    rdf <- x$rank[1]
    if (rdf > 5L) {
        cat("Residuals:\n")
    nam <- c("Min", "1Q", "Median", "3Q", "Max")
    zz <- zapsmall(quantile(resid), digits + 1)
    rq <- structure(zz, names = nam)
        
    print(rq, digits = digits, ...)
    } else if (rdf > 0L) {
        print(resid, digits = digits, ...)
    } else { # rdf == 0 : perfect fit!
        cat("ALL", df[1L], "residuals are 0: no residual degrees of freedom!\n")
    }

    z <- x

      if(z$level == 1 & z$pval.method == 'median') {
        index <- union(which(names(z$coefficients) == '(Intercept)'), which(z$coefficients != 0))
      } else if(z$level == 1 & z$pval.method == 'bayes') {
        index <- union(which(names(z$coefficients) == '(Intercept)'), which(z$p.value < 0.5))
      } else if(z$level == 1 & z$pval.method == 'median') {
        index <- union(which(names(z$coefficients) == '(Intercept)'), which(z$p.value != 1))
      } else if(z$level == 2) {
        index <- union(union(which(names(z$coefficients) == '(Intercept)'), which(z$coefficients != 0)), which(z$p.value != 1))
      } else {
        index <- 1:length(z$coefficients)
      } 
      z$lower.bound <- z$lower.bound[index]
      z$upper.bound <- z$upper.bound[index]
      z$p.value <- z$p.value[index]
      z$coefficients <- z$coefficients[index]


    cat("\nCoefficients:\n")
    if(is.null(z$p.value)) {
        MAT <- cbind(z$coefficients)
        colnames(MAT) <- c("Estimate")
        HDprintCoefmat(MAT, digits=digits, signif.stars=FALSE, na.print="NA", pval=FALSE)
    } else {
        MAT <- cbind(z$coefficients, z$lower.bound, z$upper.bound, z$p.value)
        colnames(MAT) <- c("Estimate", "Lower Bd", "Upper Bd", "P-value")
        HDprintCoefmat(MAT, digits=digits, signif.stars=signif.stars, na.print="NA")
    }

    cat("\n")#- not in S
    invisible(x)
}

Try the hdlm package in your browser

Any scripts or data that you put into this service are public.

hdlm documentation built on May 2, 2019, 8:35 a.m.