1
2R version 3.1.0 (2014-04-10) -- "Spring Dance"
3Copyright (C) 2014 The R Foundation for Statistical Computing
4Platform: x86_64-apple-darwin13.1.0 (64-bit)
5
6R is free software and comes with ABSOLUTELY NO WARRANTY.
7You are welcome to redistribute it under certain conditions.
8Type 'license()' or 'licence()' for distribution details.
9
10R is a collaborative project with many contributors.
11Type 'contributors()' for more information and
12'citation()' on how to cite R or R packages in publications.
13
14Type 'demo()' for some demos, 'help()' for on-line help, or
15'help.start()' for an HTML browser interface to help.
16Type 'q()' to quit R.
17
18> ##
19> ## Calibration with badly-scaled initial weights (bug report by Takahiro Tsuchiya)
20> ##
21> library(survey)
22
23Attaching package: 'survey'
24
25The following object is masked from 'package:graphics':
26
27    dotchart
28
29> data <- data.frame(x=c(1,1,1,1,2,2,2,2,2,2), w=rep(10,10))
30> des <- svydesign(ids=~1, weights=~w, data=data)
31> des.c <- calibrate(des, ~factor(x), c(10000, 5000))
32> des.r <- calibrate(des, ~factor(x), c(10000, 5000), calfun='raking')
33Loading required package: MASS
34> stopifnot(all.equal(svytotal(~factor(x), des.c), svytotal(~factor(x), des.r)))
35>
36> proc.time()
37   user  system elapsed
38  0.162   0.025   0.194
39