Description Usage Arguments Details Value Author(s) References See Also Examples
For a given sample size, in each stratum, this function returns a vector of first order inclusion probabilities for an stratified sampling design proportional to an auxiliary variable.
1 | PikSTPPS(S, x, nh)
|
S |
Vector identifying the membership to the strata of each unit in the population. |
x |
Vector of auxiliary information for each unit in the population. |
nh |
The vector defningn the sample size in each stratum. |
is not always less than unity. A sequential algorithm must be used in order to ensure that for every unit in the population the inclusion probability gives a proper value; i.e. less or equal to unity.
A vector of inclusion probablilities in a stratified finite population.
Hugo Andres Gutierrez Rojas <hagutierrezro at gmail.com>
Gutierrez, H. A. (2009), Estrategias de muestreo: Diseno de encuestas y estimacion de parametros. Editorial Universidad Santo Tomas Sarndal, C-E. and Swensson, B. and Wretman, J. (2003), Model Assisted Survey Sampling. Springer.
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 42 43 44 45 46 47 48 49 50 51 52 | ############
## Example 1
############
# Vector U contains the label of a population of size N=5
U <- c("Yves", "Ken", "Erik", "Sharon", "Leslie")
# The auxiliary information
x <- c(52, 60, 75, 100, 50)
# Vector Strata contains an indicator variable of stratum membership
Strata <- c("A", "A", "A", "B", "B")
# The sample size in each stratum
nh <- c(2,2)
# The vector of inclusion probablities for a stratified piPS sample
# without replacement of size two within each stratum
Pik <- PikSTPPS(Strata, x, nh)
Pik
# Some checks
sum(Pik)
sum(nh)
############
## Example 2
############
# Uses the Lucy data to compute the vector of inclusion probablities
# for a stratified random sample according to a piPS design in each stratum
data(Lucy)
attach(Lucy)
# Level is the stratifying variable
summary(Level)
# Defines the size of each stratum
N1<-summary(Level)[[1]]
N2<-summary(Level)[[2]]
N3<-summary(Level)[[3]]
N1;N2;N3
# Defines the sample size at each stratum
n1<-70
n2<-100
n3<-200
nh<-c(n1,n2,n3)
nh
# Computes the inclusion probabilities for the stratified population
S <- Level
x <- Employees
Pik <- PikSTPPS(S, x, nh)
# Some checks
sum(Pik)
sum(nh)
|
Loading required package: dplyr
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
Loading required package: magrittr
[,1]
[1,] 0.5561497
[2,] 0.6417112
[3,] 0.8021390
[4,] 1.0000000
[5,] 1.0000000
[1] 4
[1] 4
Big Medium Small
83 737 1576
[1] 83
[1] 737
[1] 1576
[1] 70 100 200
[1] 370
[1] 370
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.