1# These functions are 2# Copyright (C) 1998-2021 T.W. Yee, University of Auckland. 3# All rights reserved. 4 5 6 7 8 9 10 11 12show.vlm <- function(object) { 13 if (!is.null(cl <- object@call)) { 14 cat("Call:\n") 15 dput(cl) 16 } 17 18 coef <- object@coefficients 19 cat("\nCoefficients:\n") 20 print(coef) 21 22 rank <- object@rank 23 if (is.null(rank)) 24 rank <- sum(!is.na(coef)) 25 n <- object@misc$n 26 M <- object@misc$M 27 nobs <- if (length(object@df.total)) object@df.total else n * M 28 rdf <- object@df.residual 29 if (is.null(rdf)) 30 rdf <- (n - rank) * M 31 cat("\nDegrees of Freedom:", nobs, "Total;", 32 rdf, "Residual\n") 33 34 if (length(deviance(object)) && 35 is.finite(deviance(object))) 36 cat("Deviance:", format(deviance(object)), "\n") 37 if (length(object@ResSS) && 38 is.finite(object@ResSS)) 39 cat("Residual Sum of Squares:", format(object@ResSS), "\n") 40 41 invisible(object) 42} 43 44 45 46setMethod("show", "vlm", 47 function(object) 48 show.vlm(object)) 49 50 51 52 53 54 55 56if (FALSE) 57print.vlm <- function(x, ...) { 58 if (!is.null(cl <- x@call)) { 59 cat("Call:\n") 60 dput(cl) 61 } 62 63 coef <- x@coefficients 64 cat("\nCoefficients:\n") 65 print(coef, ...) 66 67 rank <- x@rank 68 if (is.null(rank)) 69 rank <- sum(!is.na(coef)) 70 n <- x@misc$n 71 M <- x@misc$M 72 nobs <- if (length(x@df.total)) x@df.total else n * M 73 rdf <- x@df.residual 74 if (is.null(rdf)) 75 rdf <- (n - rank) * M 76 cat("\nDegrees of Freedom:", nobs, "Total;", 77 rdf, "Residual\n") 78 79 if (length(deviance(x)) && 80 is.finite(deviance(x))) 81 cat("Deviance:", format(deviance(x)), "\n") 82 if (length(x@ResSS) && 83 is.finite(x@ResSS)) 84 cat("Residual Sum of Squares:", format(x@ResSS), "\n") 85 86 invisible(x) 87} 88 89 90 91 92if (!is.R()) { 93setMethod("show", "vlm", 94 function(object) 95 print.vlm(object)) 96} 97 98 99 100if (FALSE) 101setMethod("print", "vlm", 102 function(x, ...) 103 print.vlm(x, ...)) 104 105 106 107