]> git.donarmstrong.com Git - ape.git/blob - R/print.lmorigin.R
new mixedFontLabel() + bug fix in rTraitCont.c
[ape.git] / R / print.lmorigin.R
1 'print.lmorigin' <-
2     function(x, ...)
3 {
4         if(x$origin) {
5                 cat("\nRegression through the origin",'\n')
6                 } else {
7                 cat("\nMultiple regression with estimation of intercept",'\n')
8                 }
9         cat("\nCall:\n")
10     cat(deparse(x$call),'\n')
11         if(x$origin) { names <- x$var.names[-1] }
12                 else { names <- c("(Intercept)",x$var.names[-1]) }
13
14         cat("\nCoefficients and parametric test results \n",'\n')
15         res <- as.data.frame(cbind(summary(x$reg)$coefficients[,1], summary(x$reg)$coefficients[,2], summary(x$reg)$coefficients[,3], summary(x$reg)$coefficients[,4]))
16         rownames(res) <- names
17         colnames(res) <- c("Coefficient","Std_error","t-value","Pr(>|t|)")
18         printCoefmat(res, P.values=TRUE, signif.stars=TRUE)
19         
20         if(x$nperm > 0) {
21                 cat("\nTwo-tailed tests of regression coefficients\n",'\n')
22                 res2 <- as.data.frame(cbind(summary(x$reg)$coefficients[,1], x$p.param.t.2tail, x$p.perm.t.2tail))
23                 rownames(res2) <- names
24                 colnames(res2) <- c("Coefficient","p-param","p-perm")
25                 nc <- 3
26                 printCoefmat(res2, P.values=TRUE, signif.stars=TRUE, has.Pvalue = 3 && substr(colnames(res2)[3],1,6) == "p-perm")
27
28                 cat("\nOne-tailed tests of regression coefficients:",'\n')
29                 cat("test in the direction of the sign of the coefficient\n",'\n')
30                 res1 <- as.data.frame(cbind(summary(x$reg)$coefficients[,1], x$p.param.t.1tail, x$p.perm.t.1tail))
31                 rownames(res1) <- names
32                 colnames(res1) <- c("Coefficient","p-param","p-perm")
33                 nc <- 3
34                 printCoefmat(res1, P.values=TRUE, signif.stars=TRUE, has.Pvalue = 3 && substr(colnames(res1)[3],1,6) == "p-perm")
35
36                 }
37         cat("\nResidual standard error:", summary(x$reg)$sigma, "on", summary(x$reg)$df[2],"degrees of freedom",'\n')
38         cat("Multiple R-square:", summary(x$reg)$r.squared,"  Adjusted R-square:", summary(x$reg)$adj.r.squared,'\n')
39
40         F   <- summary(x$reg)$fstatistic[[1]]
41         df1 <- summary(x$reg)$fstatistic[[2]]
42         df2 <- summary(x$reg)$fstatistic[[3]]
43         p.param.F <- pf(F, df1, df2, lower.tail=FALSE)
44         cat("\nF-statistic:", F, "on", df1, "and", df2, "DF:\n")
45         cat("   parametric p-value   :", p.param.F,'\n')
46         if(x$nperm > 0) {
47                 cat("   permutational p-value:", x$p.perm.F,'\n')
48                 if(x$method == "raw") {
49                         cat("after",x$nperm,"permutations of",x$method,"data",'\n','\n')
50                         } else {
51                         cat("after",x$nperm,"permutations of",x$method,"of full model",'\n','\n')
52                         }                       
53                 }
54     invisible(x) 
55 }