Description Usage Arguments Details Author(s) References Examples
Adjustment of a table on the margins
1 | IPFP(Table, Col.knw, Row.knw, tol=0.0001)
|
Table |
A contingency table |
Col.knw |
A vector containing the true totals of the columns |
Row.knw |
A vector containing the true totals of the Rows |
tol |
The control value, by default equal to 0.0001 |
Adjust a contingency table on the know margins of the population with the Raking Ratio method
Hugo Andres Gutierrez Rojas hagutierrezro@gmail.com
Deming, W. & Stephan, F. (1940), On a least squares adjustment of a sampled frequency
table when the expected marginal totals are known. Annals of Mathematical Statistics, 11, 427-444.
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 | ############
## Example 1
############
# Some example of Ardilly and Tille
Table <- matrix(c(80,90,10,170,80,80,150,210,130),3,3)
rownames(Table) <- c("a1", "a2","a3")
colnames(Table) <- c("b1", "b2","b3")
# The table with labels
Table
# The known and true margins
Col.knw <- c(150,300,550)
Row.knw <- c(430,360,210)
# The adjusted table
IPFP(Table,Col.knw,Row.knw,tol=0.0001)
############
## Example 2
############
# Draws a simple random sample
data(Lucy)
attach(Lucy)
N<-dim(Lucy)[1]
n<-400
sam<-sample(N,n)
data<-Lucy[sam,]
attach(data)
dim(data)
# Two domains of interest
Doma1<-Domains(Level)
Doma2<-Domains(SPAM)
# Cross tabulate of domains
SPAM.no<-Doma2[,1]*Doma1
SPAM.yes<-Doma2[,2]*Doma1
# Estimation
E.SI(N,n,Doma1)
E.SI(N,n,Doma2)
est1 <-E.SI(N,n,SPAM.no)[,2:4]
est2 <-E.SI(N,n,SPAM.yes)[,2:4]
est1;est2
# The contingency table estimated from above
Table <- cbind(est1[1,],est2[1,])
rownames(Table) <- c("Big", "Medium","Small")
colnames(Table) <- c("SPAM.no", "SPAM.yes")
# The known and true margins
Col.knw <- colSums(Domains(Lucy$SPAM))
Row.knw<- colSums(Domains(Lucy$Level))
# The adjusted table
IPFP(Table,Col.knw,Row.knw,tol=0.0001)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.