Description Usage Arguments Examples
Harmonisation by calibration
1 | harmonize(X1, d1, id1, X2, d2, id2, totals)
|
X1 |
dataset 1 |
d1 |
weights 1 |
id1 |
identifiers 1 |
X2 |
dataset 2 |
d2 |
weigths 2 |
id2 |
identifiers 2 |
totals |
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 | N <- 10000
X <- data.frame(x1 = rnorm(N,0,1), x2 = rnorm(N,0,1))
n1=1000
n2=3000
s1=srswor(n1,N)
s2=srswor(n2,N)
id1=(1:N)[s1==1]
id2=(1:N)[s2==1]
d1=rep(N/n1,n1)
d2=rep(N/n2,n2)
X1 = X[s1==1,]
X2 = X[s2==1,]
W <- harmonize(X1,d1,id1,X2,d2,id2)
colSums(W$w1*X1)
colSums(W$w2*X2)
############## if knowing the true totals
totals <- c(N,colSums(X))
W <- harmonize(X1,d1,id1,X2,d2,id2,totals)
colSums(W$w1*X1)
colSums(W$w2*X2)
colSums(X)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.