1## 2## Calibration with badly-scaled initial weights (bug report by Takahiro Tsuchiya) 3## 4library(survey) 5data <- data.frame(x=c(1,1,1,1,2,2,2,2,2,2), w=rep(10,10)) 6des <- svydesign(ids=~1, weights=~w, data=data) 7des.c <- calibrate(des, ~factor(x), c(10000, 5000)) 8des.r <- calibrate(des, ~factor(x), c(10000, 5000), calfun='raking') 9stopifnot(all.equal(svytotal(~factor(x), des.c), svytotal(~factor(x), des.r))) 10