domain: Extra variables for domain estimation

Description Usage Arguments Value References See Also Examples

View source: R/domain.R

Description

The function computes extra variables for domain estimation. Each unique D row defines a domain. Extra variables are computed for each Y variable.

Usage

1
  domain(Y, D, dataset = NULL, checking = TRUE)

Arguments

Y

Matrix of study variables. Any object convertable to data.table with numeric values, NA values are not allowed. Object convertible to data.table or variable names as character, column numbers.

D

Matrix of domain variables. Any object convertable to data.table. The number of rows of D must match the number of rows of Y. Duplicated names are not allowed. Object convertible to data.table or variable names as character, column numbers.

dataset

Optional survey data object convertible to data.table.

checking

Optional variable if this variable is TRUE, then function checks data preparation errors, otherwise not checked. This variable by default is TRUE.

Value

Numeric data.table containing extra variables for domain estimation.

References

Carl-Erik Sarndal, Bengt Swensson, Jan Wretman. Model Assisted Survey Sampling. Springer-Verlag, 1992, p.70.

See Also

vardom, vardomh

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
### Example 0

domain(1, "A")


### Example 1

Y <- as.matrix(1 : 10)
colnames(Y) <- "Y1"
D <- as.matrix(rep(1, 10))
colnames(D) <- "D1"
domain(Y, D)


### Example 2

Y <- matrix(1 : 20, 10, 2)
colnames(Y) <- paste0("Y", 1 : 2)
D <- matrix(rep(1 : 2, each = 5), 10, 1)
colnames(D) <- "D"
domain(Y, D)


### Example 3

Y <- matrix(1 : 20, 10, 2)
colnames(Y) <- paste0("Y", 1 : 2)
D <- matrix(rep(1 : 4, each = 5), 10, 2)
colnames(D) <- paste0("D", 1 : 2)
domain(Y, D)


### Example 4

Y <- matrix(1 : 20, 10, 2)
colnames(Y) <- paste0("Y", 1 : 2)
D <- matrix(c(rep(1 : 2, each = 5), rep(3, 10)), 10, 2)
colnames(D) <- paste0("D", 1 : 2)
domain(Y, D)

vardpoor documentation built on May 19, 2017, 6:09 p.m.

Search within the vardpoor package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.