# Domains: Domains Indicator Matrix In TeachingSampling: Selection of Samples and Parameter Estimation in Finite Population

## Description

Creates a matrix of domain indicator variables for every single unit in the selected sample or in the entire population

## Usage

 1 Domains(y) 

## Arguments

 y Vector of the domain of interest containing the membership of each unit to a specified category of the domain

## Details

Each value of y represents the domain which a specified unit belongs

## Value

The function returns a n\times p matrix, where n is the number of units in the selected sample and p is the number of categories of the domain of interest. The values of this matrix are zero, if the unit does not belongs to a specified category and one, otherwise.

## Author(s)

Hugo Andres Gutierrez Rojas hagutierrezro@gmail.com

## References

Sarndal, C-E. and Swensson, B. and Wretman, J. (1992), Model Assisted Survey Sampling. Springer.
Gutierrez, H. A. (2009), Estrategias de muestreo: Diseno de encuestas y estimacion de parametros. Editorial Universidad Santo Tomas.

E.SI

## 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 40 41 ############ ## Example 1 ############ # This domain contains only two categories: "yes" and "no" x <- as.factor(c("yes","yes","yes","no","no","no","no","yes","yes")) Domains(x) ############ ## Example 2 ############ # Uses the Lucy data to draw a random sample of units according # to a SI design data(Lucy) attach(Lucy) N <- dim(Lucy)[1] n <- 400 sam <- sample(N,n) # The information about the units in the sample is stored in an object called data data <- Lucy[sam,] attach(data) names(data) # The variable SPAM is a domain of interest Doma <- Domains(SPAM) Doma # HT estimation of the absolute domain size for every category in the domain # of interest E.SI(N,n,Doma) ############ ## Example 3 ############ # Following with Example 2... # The variables of interest are: Income, Employees and Taxes # This function allows to estimate the population total of this variables for every # category in the domain of interest SPAM estima <- data.frame(Income, Employees, Taxes) SPAM.no <- estima*Doma[,1] SPAM.yes <- estima*Doma[,2] E.SI(N,n,SPAM.no) E.SI(N,n,SPAM.yes) 

### Example output

      no yes
[1,]  0   1
[2,]  0   1
[3,]  0   1
[4,]  1   0
[5,]  1   0
[6,]  1   0
[7,]  1   0
[8,]  0   1
[9,]  0   1
The following objects are masked from Lucy:

Employees, ID, Income, Level, SPAM, Taxes, Ubication, Zone

[1] "ID"        "Ubication" "Level"     "Zone"      "Income"    "Employees"
[7] "Taxes"     "SPAM"
no yes
[1,]  1   0
[2,]  0   1
[3,]  0   1
[4,]  0   1
[5,]  0   1
[6,]  0   1
[7,]  0   1
[8,]  1   0
[9,]  0   1
[10,]  0   1
[11,]  0   1
[12,]  1   0
[13,]  1   0
[14,]  1   0
[15,]  0   1
[16,]  0   1
[17,]  0   1
[18,]  0   1
[19,]  0   1
[20,]  0   1
[21,]  1   0
[22,]  0   1
[23,]  0   1
[24,]  1   0
[25,]  0   1
[26,]  0   1
[27,]  0   1
[28,]  1   0
[29,]  0   1
[30,]  0   1
[31,]  1   0
[32,]  1   0
[33,]  1   0
[34,]  0   1
[35,]  0   1
[36,]  0   1
[37,]  1   0
[38,]  1   0
[39,]  1   0
[40,]  1   0
[41,]  0   1
[42,]  0   1
[43,]  1   0
[44,]  1   0
[45,]  1   0
[46,]  1   0
[47,]  1   0
[48,]  1   0
[49,]  1   0
[50,]  1   0
[51,]  0   1
[52,]  1   0
[53,]  0   1
[54,]  1   0
[55,]  0   1
[56,]  1   0
[57,]  1   0
[58,]  1   0
[59,]  1   0
[60,]  1   0
[61,]  1   0
[62,]  0   1
[63,]  0   1
[64,]  0   1
[65,]  1   0
[66,]  0   1
[67,]  0   1
[68,]  0   1
[69,]  1   0
[70,]  1   0
[71,]  0   1
[72,]  0   1
[73,]  0   1
[74,]  0   1
[75,]  0   1
[76,]  1   0
[77,]  1   0
[78,]  1   0
[79,]  1   0
[80,]  0   1
[81,]  1   0
[82,]  0   1
[83,]  1   0
[84,]  1   0
[85,]  0   1
[86,]  1   0
[87,]  1   0
[88,]  1   0
[89,]  1   0
[90,]  0   1
[91,]  1   0
[92,]  1   0
[93,]  1   0
[94,]  1   0
[95,]  1   0
[96,]  1   0
[97,]  0   1
[98,]  1   0
[99,]  0   1
[100,]  1   0
[101,]  1   0
[102,]  0   1
[103,]  1   0
[104,]  1   0
[105,]  0   1
[106,]  0   1
[107,]  1   0
[108,]  1   0
[109,]  1   0
[110,]  0   1
[111,]  0   1
[112,]  1   0
[113,]  0   1
[114,]  0   1
[115,]  0   1
[116,]  0   1
[117,]  0   1
[118,]  0   1
[119,]  1   0
[120,]  0   1
[121,]  1   0
[122,]  0   1
[123,]  1   0
[124,]  0   1
[125,]  0   1
[126,]  0   1
[127,]  1   0
[128,]  0   1
[129,]  0   1
[130,]  0   1
[131,]  0   1
[132,]  0   1
[133,]  0   1
[134,]  1   0
[135,]  1   0
[136,]  1   0
[137,]  1   0
[138,]  1   0
[139,]  1   0
[140,]  1   0
[141,]  0   1
[142,]  0   1
[143,]  0   1
[144,]  1   0
[145,]  0   1
[146,]  0   1
[147,]  0   1
[148,]  0   1
[149,]  0   1
[150,]  0   1
[151,]  1   0
[152,]  1   0
[153,]  0   1
[154,]  0   1
[155,]  1   0
[156,]  1   0
[157,]  0   1
[158,]  1   0
[159,]  0   1
[160,]  0   1
[161,]  1   0
[162,]  0   1
[163,]  0   1
[164,]  0   1
[165,]  0   1
[166,]  1   0
[167,]  1   0
[168,]  1   0
[169,]  0   1
[170,]  1   0
[171,]  0   1
[172,]  1   0
[173,]  1   0
[174,]  0   1
[175,]  0   1
[176,]  0   1
[177,]  0   1
[178,]  1   0
[179,]  0   1
[180,]  0   1
[181,]  0   1
[182,]  1   0
[183,]  0   1
[184,]  1   0
[185,]  1   0
[186,]  1   0
[187,]  0   1
[188,]  0   1
[189,]  1   0
[190,]  1   0
[191,]  0   1
[192,]  1   0
[193,]  0   1
[194,]  0   1
[195,]  0   1
[196,]  1   0
[197,]  1   0
[198,]  0   1
[199,]  0   1
[200,]  1   0
[201,]  0   1
[202,]  1   0
[203,]  0   1
[204,]  1   0
[205,]  0   1
[206,]  1   0
[207,]  0   1
[208,]  0   1
[209,]  1   0
[210,]  0   1
[211,]  1   0
[212,]  0   1
[213,]  0   1
[214,]  0   1
[215,]  1   0
[216,]  1   0
[217,]  1   0
[218,]  0   1
[219,]  0   1
[220,]  0   1
[221,]  1   0
[222,]  0   1
[223,]  1   0
[224,]  0   1
[225,]  1   0
[226,]  0   1
[227,]  0   1
[228,]  1   0
[229,]  1   0
[230,]  1   0
[231,]  1   0
[232,]  0   1
[233,]  1   0
[234,]  0   1
[235,]  0   1
[236,]  0   1
[237,]  1   0
[238,]  0   1
[239,]  0   1
[240,]  0   1
[241,]  1   0
[242,]  0   1
[243,]  0   1
[244,]  1   0
[245,]  1   0
[246,]  1   0
[247,]  0   1
[248,]  0   1
[249,]  1   0
[250,]  0   1
[251,]  1   0
[252,]  1   0
[253,]  1   0
[254,]  0   1
[255,]  1   0
[256,]  1   0
[257,]  1   0
[258,]  1   0
[259,]  0   1
[260,]  0   1
[261,]  0   1
[262,]  0   1
[263,]  1   0
[264,]  1   0
[265,]  1   0
[266,]  1   0
[267,]  1   0
[268,]  1   0
[269,]  1   0
[270,]  1   0
[271,]  0   1
[272,]  0   1
[273,]  0   1
[274,]  0   1
[275,]  1   0
[276,]  0   1
[277,]  0   1
[278,]  1   0
[279,]  0   1
[280,]  1   0
[281,]  0   1
[282,]  1   0
[283,]  0   1
[284,]  0   1
[285,]  0   1
[286,]  0   1
[287,]  0   1
[288,]  1   0
[289,]  0   1
[290,]  0   1
[291,]  0   1
[292,]  1   0
[293,]  0   1
[294,]  0   1
[295,]  0   1
[296,]  0   1
[297,]  1   0
[298,]  1   0
[299,]  1   0
[300,]  1   0
[301,]  0   1
[302,]  1   0
[303,]  0   1
[304,]  0   1
[305,]  0   1
[306,]  0   1
[307,]  0   1
[308,]  0   1
[309,]  1   0
[310,]  0   1
[311,]  1   0
[312,]  0   1
[313,]  0   1
[314,]  1   0
[315,]  0   1
[316,]  1   0
[317,]  0   1
[318,]  1   0
[319,]  0   1
[320,]  0   1
[321,]  1   0
[322,]  0   1
[323,]  0   1
[324,]  0   1
[325,]  0   1
[326,]  1   0
[327,]  0   1
[328,]  0   1
[329,]  1   0
[330,]  0   1
[331,]  0   1
[332,]  0   1
[333,]  0   1
[334,]  1   0
[335,]  0   1
[336,]  0   1
[337,]  1   0
[338,]  1   0
[339,]  0   1
[340,]  0   1
[341,]  0   1
[342,]  0   1
[343,]  0   1
[344,]  0   1
[345,]  1   0
[346,]  0   1
[347,]  1   0
[348,]  0   1
[349,]  0   1
[350,]  1   0
[351,]  0   1
[352,]  1   0
[353,]  1   0
[354,]  1   0
[355,]  0   1
[356,]  1   0
[357,]  0   1
[358,]  0   1
[359,]  0   1
[360,]  0   1
[361,]  0   1
[362,]  1   0
[363,]  0   1
[364,]  0   1
[365,]  1   0
[366,]  1   0
[367,]  1   0
[368,]  0   1
[369,]  0   1
[370,]  0   1
[371,]  0   1
[372,]  0   1
[373,]  0   1
[374,]  1   0
[375,]  0   1
[376,]  0   1
[377,]  0   1
[378,]  0   1
[379,]  1   0
[380,]  0   1
[381,]  0   1
[382,]  1   0
[383,]  0   1
[384,]  0   1
[385,]  0   1
[386,]  1   0
[387,]  0   1
[388,]  0   1
[389,]  0   1
[390,]  0   1
[391,]  0   1
[392,]  0   1
[393,]  0   1
[394,]  0   1
[395,]  0   1
[396,]  0   1
[397,]  1   0
[398,]  0   1
[399,]  1   0
[400,]  0   1
N         no         yes
Estimation     2396 1024.29000 1371.710000
Standard Error    0   54.16179   54.161793
CVE               0    5.28774    3.948487
DEFF            NaN    1.00000    1.000000
N       Income   Employees        Taxes
Estimation     2396 4.310823e+05 60792.51000 11114.445000
Standard Error    0 2.861642e+04  3847.71602  1090.885873
CVE               0 6.638273e+00     6.32926     9.815028
DEFF            NaN 1.000000e+00     1.00000     1.000000
N       Income    Employees        Taxes
Estimation     2396 6.210672e+05 88687.940000 17619.585000
Standard Error    0 3.276007e+04  4470.242148  1632.874048
CVE               0 5.274802e+00     5.040417     9.267381
DEFF            NaN 1.000000e+00     1.000000     1.000000


TeachingSampling documentation built on April 22, 2020, 1:05 a.m.