a b/partyMod/R/zInitMethods.R
1
2
# $Id$
3
4
setMethod(f = "initialize", signature = "ExpectCovar",
5
    definition = function(.Object, pq = 1) {
6
        pq <- as.integer(pq)
7
        .Object@expectation <- rep(0, pq)
8
        .Object@covariance <- matrix(0, nrow = pq, ncol = pq)
9
        .Object@dimension  <- as.integer(pq)
10
        .Object
11
    }
12
)
13
14
15
setMethod(f = "initialize", signature = "ExpectCovarInfluence",
16
    definition = function(.Object, q) {
17
        .Object@expectation <- rep(0, q)
18
        .Object@covariance <- matrix(0, nrow = q, ncol = q)
19
        .Object@dimension  <- as.integer(q)
20
        .Object@sumweights <- log(1) ### was as.double(0.0) but 
21
                                     ### there seem to be protection issues
22
        .Object
23
    }
24
)
25
26
27
setMethod(f = "initialize", signature = "LinStatExpectCovar",
28
    definition = function(.Object, p, q) {
29
        .Object@expectation <- rep(0, p*q)
30
        .Object@covariance <- matrix(0, nrow = p*q, ncol = p*q)
31
        .Object@dimension  <- p*q
32
        .Object@linearstatistic <- rep(0, p*q)
33
        .Object@expcovinf <- new("ExpectCovarInfluence", q)
34
        .Object
35
    }
36
)
37
38
setMethod(f = "initialize", signature = "LinStatExpectCovarMPinv",
39
    definition = function(.Object, p, q) {
40
        .Object@expectation <- rep(0, p*q)
41
        .Object@covariance <- matrix(0, nrow = p*q, ncol = p*q)
42
        .Object@MPinv <- matrix(0, nrow = p*q, ncol = p*q)
43
        .Object@rank <- as.double(0.0)
44
        .Object@svdmem <- new("svd_mem", p*q)
45
        .Object@dimension  <- p*q
46
        .Object@linearstatistic <- rep(0, p*q)
47
        .Object@expcovinf <- new("ExpectCovarInfluence", q)
48
        .Object
49
    }
50
)
51
52
53
54
setMethod(f = "initialize", signature = "svd_mem",
55
    definition = function(.Object, p) {
56
        if (p <= 0) stop(sQuote("p"), " is not a positive integer")
57
        .Object@p <- as.integer(p)
58
        .Object@method <- "dgesdd"
59
        .Object@jobu <- "S"
60
        .Object@jobv <- ""
61
        .Object@u <- matrix(0, nrow = p, ncol = p)
62
        .Object@v <- matrix(0, nrow = p, ncol = p)
63
        .Object@s <- rep(0, p)
64
        .Object
65
    }
66
)
67
68
setMethod(f = "initialize", signature = "VariableFrame",
69
    definition = function(.Object, nobs, ninputs) {
70
        if (nobs <= 0 || ninputs <= 0) stop(sQuote("nobs"), " or ", 
71
            sQuote("ninputs"), " is not a positive integer")
72
        .Object@nobs <- as.integer(nobs)
73
        .Object@ninputs <- as.integer(ninputs)
74
        .Object@variables <- vector(mode = "list", length = ninputs)
75
        .Object@transformations <- vector(mode = "list", length = ninputs)
76
        .Object@is_nominal <- vector(mode = "logical", length = ninputs)
77
        .Object@is_ordinal <- vector(mode = "logical", length = ninputs)
78
        .Object@ordering <- vector(mode = "list", length = ninputs)
79
        .Object@levels <- vector(mode = "list", length = ninputs)
80
        .Object@scores <- vector(mode = "list", length = ninputs)
81
        .Object@has_missings <- vector(mode = "logical", length = ninputs)
82
        .Object@whichNA <- vector(mode = "list", length = ninputs)
83
        # .Object@jointtransf <- matrix()
84
        .Object
85
    }
86
)