getRIndicator:

Usage Arguments Examples

Usage

1
getRIndicator(formula, sampleData, sampleWeights = rep(1, nrow(sampleData)), sampleStrata = NULL, family = c("binomial", "gaussian"), withPartials = TRUE, otherVariables = character())

Arguments

formula
sampleData
sampleWeights
sampleStrata
family
withPartials
otherVariables

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
##---- 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 (formula, sampleData, sampleWeights = rep(1, nrow(sampleData)), 
    sampleStrata = NULL, family = c("binomial", "gaussian"), 
    withPartials = TRUE, otherVariables = character()) 
{
    nSample = nrow(sampleData)
    stopifnot(length(sampleWeights) == nSample)
    stopifnot(is.numeric(sampleWeights))
    if (is.null(sampleStrata)) 
        sampleStrata <- getSampleStrata(sampleWeights)
    stopifnot(is.factor(sampleStrata))
    stopifnot(length(sampleStrata) == nSample)
    sampleDesign <- getSampleDesign(sampleWeights, sampleStrata)
    family <- match.arg(family)
    model <- switch(family, binomial = list(formula = formula, 
        grad = function(mu) exp(mu)/(1 + exp(mu))^2, family = binomial(link = "logit")), 
        gaussian = list(formula = formula, grad = function(mu) 1, 
            family = gaussian(link = "identity")))
    indicator <- getRSampleBased(model, sampleData, sampleDesign)
    if (withPartials) 
        indicator$partials <- getPartialRs(indicator, sampleData, 
            sampleDesign, otherVariables)
    return(indicator)
  }

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