printCoefmat
Print Coefficient Matrices

Description

Prints a coefficient matrix or data frame in the defined format.

Usage

printCoefmat(x,
             digits = max(3, getOption("digits") - 2),
             signif.stars = getOption("show.signif.stars"), 
             signif.legend = NULL,
             dig.tst = max(1, min(5, digits - 1)),
             cs.ind = NULL, 
             tst.ind = NULL,
             zap.ind = integer(0),
             P.values = NULL,
             has.Pvalue = nc >= 4 && grepl("^Pr?(.*)$", colnames(x)[nCol])
             eps.Pvalue = .Machine$double.eps,
             na.print = "NA",
             ...)

Arguments

x a coefficient matrix or a data frame.
digits a small positive integer. The number of significant digits to be used for printing. The default is the value of the option "digits" minus 2, and the minimum is 3.
signif.stars a logical value. If TRUE, the P-values column is encoded as a number of significance stars shown at the right side of the matrix. The default is the value of the option "show.signif.stars".
signif.legend a logical value. If TRUE, a legend showing the meaning of the significance stars is printed below the matrix. The default value is equal to signif.stars.
dig.tst the number of significant digits with which to display the test statistics. The default value is digits-1. It must between 1 and 5.
cs.ind the indices of the columns containing coefficients and standard errors. The default is all columns of x except for the test statistic and P-value columns.
tst.ind the indices of column number of test statistics. The default is the index of the P-value column.
zap.ind the indices of the non-P-value columns that should have small numbers displayed as "0" (by using the zapsmall function).
P.values a logical or NULL.
  • If TRUE, then the last column of x is formated as P-values by using format.pval function.
  • If FALSE then the last column is formatted the same as the other columns.
  • If NULL, then it is set to TRUE if both getOption("show.coef.Pvalues") and the argument has.Pvalue are TRUE.
has.Pvalue a logical value. If TRUE, then the last column of x is treated as P-values. P-values are printed only if above P.values is TRUE. The default value is set to TRUE if the number of column of x is at least 4 and the name of last column is of the form "P(...)" or "Pr(...)".
eps.Pvalue the numeric tolerance for the P-value format that is used by the format.pval function.
na.print a character string used to represent missing values in the printout.
... other arguments to pass to or from function.

Details

This utility function is used by print methods for several statistical models to display matrices of model coefficients and related quantities.
See Also
format, format.pval, zapsmall, print.summary.lm
Examples
# Create a coefficient matrix and fill the data.
x <- matrix(NA, nrow = 5, ncol = 4, dimnames = list(c(1:5), 
                       c("Estimate","Std.Error","z value", "Pr(>|z|)")))
set.seed(1)
x[,1] <- rnorm(5, 6)
x[,2] <- sqrt(rchisq(5, 6))
x[,3] <- x[,1]/x[,2]
x[,4] <- 2*pnorm(-x[,3])

printCoefmat(x) printCoefmat(x[,-4]) # print a matrix without p-value column.

printCoefmat(x, digits = 2, signif.stars = FALSE) printCoefmat(x, digits = 2, signif.stars = TRUE, signif.legend = FALSE)

printCoefmat(x, has.Pvalue = FALSE)

Package stats version 6.1.4-13
Package Index