Description Usage Arguments Details Value Author(s) References See Also Examples

Computes the estimation of a population quantile using the principles of the Horvitz-Thompson estimator

1 | ```
E.Quantile(y, Qn, Pik)
``` |

`y` |
Vector, matrix or data frame containing the recollected information of the variables of interest for every unit in the selected sample |

`Qn` |
Quantile of interest |

`Pik` |
A vector containing inclusion probabilities for each unit in the sample. If missing, the function will assign the same weights to each unit in the sample |

Returns the estimation of the population quantile of every single variable of interest

The function returns a vector whose entries correspond to the estimated quantiles of the variables of interest

Hugo Andres Gutierrez Rojas hagutierrezro@gmail.com

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.

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 | ```
############
## Example 1
############
# Vector U contains the label of a population of size N=5
U <- c("Yves", "Ken", "Erik", "Sharon", "Leslie")
# Vectors y and x give the values of the variables of interest
y<-c(32, 34, 46, 89, 35)
x<-c(52, 60, 75, 100, 50)
z<-cbind(y,x)
# Inclusion probabilities for a design of size n=2
Pik<-c(0.58, 0.34, 0.48, 0.33, 0.27)
# Estimation of the sample median
E.Quantile(y, 0.5)
# Estimation of the sample Q1
E.Quantile(x, 0.25)
# Estimation of the sample Q3
E.Quantile(z, 0.75)
# Estimation of the sample median
E.Quantile(z, 0.5, Pik)
############
## Example 2
############
# Uses the Lucy data to draw a PPS sample with replacement
data(Lucy)
attach(Lucy)
# The selection probability of each unit is proportional to the variable Income
# The sample size is m=400
m=400
res <- S.PPS(m,Income)
# The selected sample
sam <- res[,1]
# The information about the units in the sample is stored in an object called data
data <- Lucy[sam,]
attach(data)
# The vector of selection probabilities of units in the sample
pk.s <- res[,2]
# The vector of inclusion probabilities of units in the sample
Pik.s<-1-(1-pk.s)^m
# The information about the sample units is stored in an object called data
data <- Lucy[sam,]
attach(data)
names(data)
# The variables of interest are: Income, Employees and Taxes
# This information is stored in a data frame called estima
estima <- data.frame(Income, Employees, Taxes)
# Estimation of sample median
E.Quantile(estima,0.5,Pik.s)
``` |

```
[1] 35
[1] 52
[1] 39.4 66.0
[1] 35 60
The following objects are masked from Lucy:
Employees, ID, Income, Level, SPAM, Taxes, Ubication, Zone
The following objects are masked from data (pos = 3):
Employees, ID, Income, Level, SPAM, Taxes, Ubication, Zone
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"
[1] 328.0 69.0 10.5
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.