summaryrefslogtreecommitdiff
path: root/R/kinreport.R
blob: 4156803e5a3498096ffd4992a77111737d63bb02 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
kinreport <- function(kinobject, file = NA, vcov = FALSE, endpoint.digits = 1)
{
	if (!is.na(file)) {
		sink(file, split=TRUE)
	}

	cat("Parent compound: ", kinobject$parent, "\n")
        if (!is.null(kinobject$label)) cat("Label position:\t\t", kinobject$label, "\n")
	cat("Study type:      ", kinobject$type, "\n")
	cat("System:          ", kinobject$system, "\n")
	if (!is.null(kinobject$source)) {
          cat("Source:          ", kinobject$source, "\n")
        }
	cat("\n")
	fit.names <- names(kinobject$fits)
	for (kinmodel in fit.names)
	{
                m <- kinobject$fits[[kinmodel]]
                if (!(class(m) == "try-error")) {
                    cat("\n\n---\n")
                    cat("Nonlinear least squares fit of the", kinmodel, "model\n\n")
                    cat("Parameter estimation:\t")
                    s <- summary(m)
                    df <- s$df[2]
                    p <- 1 - pt(s$parameters[,3], df = df)
                    parms <- cbind(s$parameters[,c(1,2,3)], "Pr(>t)" = p)
                    cat("\n")
                    print(parms, digits=3)
                    cat("\n")
                    if(vcov)
                    {
                        cat("Variance-covariance matrix:\n")
                        print(vcov(m))
                        cat("\n")
                    }
                    cat("Chi2 error estimation:\t", 
                            round(100 * kinobject$results$stats[kinmodel, "err.min"], digits=2), 
                            " %\n", sep="")
                    cat("\n")
                }
	}
	cat("\n\n---\n")
	cat("Endpoint estimates\n\n")
	print(round(kinobject$results$results, digits=endpoint.digits))

	if (!is.na(file)) sink()
}

Contact - Imprint