| dg.Test-class {dynamicGraph} | R Documentation |
An example class for the test object for the model object of dynamicGraph.
newDefaultTestObject(name)
name |
Text string with the name of the test object. |
An object of class dg.Test.
The methods label and width should be
implemented by you for your test object returned by the method
testEdge of your model object.
deviance:"numeric":
The deviance of the test. df:"numeric":
The df of the test. p:"numeric":
The p-value of the test. signature(object = "dg.Test"):
Return the label of the test. signature(object = "dg.Test"):
Return the width of the test. Jens Henrik Badsberg
# Part of the example "defaultObjects" of demo:
setClass("your.Test",
representation(deviance = "numeric", df = "numeric", p = "numeric"))
"newYourTestObject" <- function(name) {
df <- round(runif(1, 1, 25))
message("Just generating a random test!!!!!")
deviance <- rchisq(1, df)
p <- 1 - pchisq(deviance, df)
result <- new("your.Test", df = df, deviance = deviance, p = p)
return(result)
}
if (!isGeneric("label") && !isGeneric("label", where = 2)) {
if (is.function("label"))
fun <- label
else
fun <- function(object) standardGeneric("label")
setGeneric("label", fun)
}
setMethod("label", "your.Test",
function(object) format(object@p, digits = 4))
if (!isGeneric("width") && !isGeneric("width", where = 2)) {
if (is.function("width"))
fun <- width
else
fun <- function(object) standardGeneric("width")
setGeneric("width", fun)
}
setMethod("width", "your.Test",
function(object) round(2 + 5 * (1 - object@p)))
newYourTestObject("TestObject")