Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

dg.Test-class

Class dg.Test


Description

An example class for the test object for the model object of dynamicGraph.

Value

An object of class dg.Test.

Objects from the Class

The methods label and width should be implemented by you for your test object returned by the method testEdge of your model object.

Slots

deviance:

Object of class "numeric": The deviance of the test.

df:

Object of class "numeric": The df of the test.

p:

Object of class "numeric": The p-value of the test.

Methods

label

signature(object = "dg.Test"): Return the label of the test.

width

signature(object = "dg.Test"): Return the width of the test.

initialize

signature(.Object = "dg.Test"): ...

setSlots

signature(object = "dg.Test"): ...

Author(s)

Jens Henrik Badsberg

See Also

Examples

# Part of the example "defaultObjects" of demo:

setClass("your.Test", 
         representation(name = "character",
                        deviance = "numeric", df = "numeric", p = "numeric"))

setMethod("setSlots", "your.Test",
          function(object, arguments) { 
            for (i in seq(along = arguments)) {
              name <- names(arguments)[i]
              if (is.element(name, slotNames(object)))
                slot(object, name) <- arguments[[i]]
              else
                message(paste("Argument '", name, "' not valid slot of '", 
                              class(object), "', thus ignored.",
                              sep = "")) }
            return(object)
          })

setMethod("initialize", "your.Test",
          function(.Object, ...) {
              # print(c("initialize", "your.Test", class(.Object)))
              Args <- list(...)
              if (!is.element("df", names(Args)) || 
                  !is.element("deviance", names(Args))) {
                Args <- (Args[!names(Args) == "df"])
                Args <- (Args[!names(Args) == "deviance"])
                .Object@df <- round(runif(1, 1, 25))
                .Object@deviance <- rchisq(1, .Object@df)
                .Object@p <- 1 - pchisq(.Object@deviance, .Object@df)
                message("Just generating a random test!!!!")
              }
              .Object <- setSlots(.Object, Args)
              return(.Object)
            }
          )


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)))

new("your.Test", name = "TestObject")

dynamicGraph

dynamicGraph

v0.2.2.6
GPL (>= 2)
Authors
Jens Henrik Badsberg <coco@badsberg.eu>
Initial release
2010/01/30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.