actualPosition: Getting a Sample from Marginal Density Functions

Description Usage Arguments Details Value Author(s) References Examples

Description

Obtains samples from the marginal density functions of the unmasked variables.

Usage

1
actualPosition(vectorL, prob, boundaryVec, size = 1)

Arguments

vectorL

Should be the dimension of the Joint Density Function

prob

The Joint Density Function

boundaryVec

Boundary of each element, min, max, min, max

size

The size of the sample

Details

Used by getSampleFromMarginalDistributionOfUnmaskedData

Value

An n*k matrix where n is the sample size and k is the number of vectors. Each column represents the sample from the marginal density of the kth variable.

Author(s)

Jordan Morris

References

no references

Examples

 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
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (vectorL, prob, boundaryVec, size = 1) 
{
    len <- length(vectorL)
    n <- c()
    for (i in 1:len) {
        n[i] <- vectorL[i]
    }
    maxSize = 1
    for (i in 1:len) {
        maxSize <- maxSize * n[i]
    }
    w <- c(0:(maxSize - 1))
    k <- sample(w, size = size, replace = TRUE, prob = prob)
    barredPoints <- matrix(nrow = size, ncol = len)
    for (i in 1:size) {
        maxSize <- 1
        for (l in 1:len) {
            maxSize <- maxSize * n[l]
        }
        for (j in 1:(len - 1)) {
            maxSize <- maxSize/n[len + 1 - j]
            if (k[i] > maxSize) {
                barredPoints[i, (len + 1 - j)] <- floor(k[i]/maxSize) + 
                  1
                k[i] <- k[i]%%maxSize + 1
            }
            else {
                barredPoints[i, (len + 1 - j)] <- 1
            }
        }
        barredPoints[i, 1] <- k[i] + 1
    }
    return(barredToActual(vectorL, boundaryVec, barredPoints))
  }

MaskJointDensity documentation built on May 2, 2019, 8:28 a.m.