getVariancePartialRUnconditional:

Usage Arguments Examples

Usage

1
getVariancePartialRUnconditional(partialIndicator, indicator, sampleData, sampleDesign)

Arguments

partialIndicator
indicator
sampleData
sampleDesign

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
##---- 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 (partialIndicator, indicator, sampleData, sampleDesign) 
{
    nPopulation <- sum(sampleDesign$weights)
    variable <- partialIndicator$variable
    byCategory <- partialIndicator$byCategory
    prop <- indicator$prop
    V1 <- numeric()
    V2 <- numeric()
    nSample <- nrow(sampleData)
    for (index in seq(nrow(byCategory))) {
        label <- byCategory[index, "category"]
        delta <- ifelse(sampleData[[variable]] == label, 1, 0)
        deltaC <- 1 - delta
        V1[index] <- sampleDesign$getVarTotal(sampleDesign, delta * 
            prop)
        V2[index] <- sampleDesign$getVarTotal(sampleDesign, deltaC * 
            prop)
    }
    partialIndicator$byCategory <- within(byCategory, {
        PuUnadjSE <- sqrt(n/nPopulation * (V1 * (1/n - 1/nPopulation)^2 + 
            V2 * (1/nPopulation)^2))
    })
    return(partialIndicator)
  }

BERENZ/RISQ documentation built on May 5, 2019, 10:25 a.m.