Running ‘3stage2phase.R’ [2s/3s]
  Running ‘DBIcheck.R’ [3s/3s]
  Running ‘anova-svycoxph.R’ [2s/3s]
  Running ‘api.R’ [2s/2s]
  Running ‘badcal.R’ [2s/2s]
  Comparing ‘badcal.Rout’ to ‘badcal.Rout.save’ ... OK
  Running ‘brewer_cpp.R’ [2s/2s]
  Running ‘by_covmat_nodrop.R’ [3s/4s]
  Running ‘bycovmat.R’ [2s/3s]
  Running ‘caleg.R’ [3s/4s]
  Running ‘check.R’ [2s/2s]
  Comparing ‘check.Rout’ to ‘check.Rout.save’ ... OK
  Running ‘confintrep.R’ [2s/3s]
  Running ‘contrast-replicates.R’ [2s/2s]
  Running ‘coxph-termtest.R’ [2s/3s]
  Running ‘deff.R’ [2s/2s]
  Comparing ‘deff.Rout’ to ‘deff.Rout.save’ ... OK
  Running ‘defftest.R’ [2s/2s]
  Running ‘degf-subset.R’ [2s/2s]
  Running ‘degf-svrepdesign.R’ [2s/2s]
  Running ‘domain.R’ [2s/2s]
  Comparing ‘domain.Rout’ to ‘domain.Rout.save’ ... OK
  Running ‘fpc.R’ [2s/2s]
  Running ‘glm-scoping.R’ [2s/2s]
  Running ‘inf_cal_test.R’ [3s/4s]
  Running ‘kalton.R’ [2s/2s]
  Comparing ‘kalton.Rout’ to ‘kalton.Rout.save’ ... OK
  Running ‘logranktest.R’ [2s/2s]
  Running ‘lonely.psu.R’ [2s/3s]
  Comparing ‘lonely.psu.Rout’ to ‘lonely.psu.Rout.save’ ... OK
  Running ‘mf_frames2.R’ [2s/2s]
  Running ‘mf_subpop.R’ [2s/2s]
  Running ‘mtcars-var.R’ [2s/2s]
  Running ‘multiphase_simple.R’ [3s/4s]
  Running ‘multistage-rcpp.R’ [2s/2s]
  Running ‘multistage.R’ [2s/2s]
  Running ‘na_action.R’ [2s/2s]
  Running ‘na_weights.R’ [2s/2s]
  Running ‘newquantile.R’ [2s/3s]
  Running ‘nwts-cch.R’ [3s/4s]
  Running ‘nwts.R’ [3s/4s]
  Comparing ‘nwts.Rout’ to ‘nwts.Rout.save’ ... OK
  Running ‘poisson.R’ [2s/2s]
  Running ‘pps.R’ [2s/2s]
  Running ‘predict-NA.R’ [2s/2s]
  Running ‘qrule-swiss.R’ [2s/2s]
  Running ‘quantile.R’ [3s/3s]
  Comparing ‘quantile.Rout’ to ‘quantile.Rout.save’ ... OK
  Running ‘quantiles-chile.R’ [2s/3s]
  Running ‘rakecheck.R’ [2s/3s]
  Running ‘raowuboot.R’ [2s/2s]
  Comparing ‘raowuboot.Rout’ to ‘raowuboot.Rout.save’ ... OK
  Running ‘regTermTest-missing.R’ [2s/2s]
  Running ‘regpredict.R’ [2s/2s]
  Comparing ‘regpredict.Rout’ to ‘regpredict.Rout.save’ ... OK
  Running ‘rss_scores.R’ [2s/3s]
  Running ‘scoping.R’ [2s/2s]
  Running ‘survcurve.R’ [5s/7s]
  Comparing ‘survcurve.Rout’ to ‘survcurve.Rout.save’ ... OK
  Running ‘svyby-strings.R’ [2s/2s]
  Running ‘svyby_bug.R’ [2s/2s]
  Running ‘svyby_se.R’ [2s/2s]
  Running ‘svycontrast.R’ [2s/2s]
  Running ‘svyivreg-var.R’ [2s/2s]
  Running ‘svyivreg.R’ [2s/2s]
  Running ‘svyolr-rake-subset.R’ [2s/2s]
  Running ‘svyolr.R’ [2s/2s]
  Running ‘testthat.R’ [4s/5s]
  Running ‘toy_example_for_postStratify.R’ [2s/2s]
  Running ‘twophase.R’ [3s/4s]
  Comparing ‘twophase.Rout’ to ‘twophase.Rout.save’ ... OK
Running the tests in ‘tests/rakecheck.R’ failed.
Complete output:
  > library(survey)
  Loading required package: grid
  Loading required package: Matrix
  Loading required package: survival
  
  Attaching package: 'survey'
  
  The following object is masked from 'package:graphics':
  
      dotchart
  
  > 
  > data(api)
  > dclus1 <- svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
  > rclus1 <- as.svrepdesign(dclus1)
  > 
  > ## population marginal totals for each stratum
  > pop.types <- data.frame(stype=c("E","H","M"), Freq=c(4421,755,1018))
  > pop.schwide <- data.frame(sch.wide=c("No","Yes"), Freq=c(1072,5122))
  > 
  > rclus1r <- rake(rclus1, list(~stype,~sch.wide), list(pop.types, pop.schwide),
  +                 control=list(epsilon=1e-10,maxit=30))
  > 
  > svymean(~api00, rclus1r)
          mean     SE
  api00 641.23 26.874
  > svytotal(~enroll, rclus1r)
           total     SE
  enroll 3647280 463582
  > 
  > ff<-~stype+sch.wide
  > poptotals<-colSums(model.matrix(ff,model.frame(ff,apipop)))
  > rclus1g<-calibrate(rclus1, ~stype+sch.wide, poptotals,calfun="raking",tol=1e-10)
  > 
  > svymean(~api00,rclus1g)
          mean     SE
  api00 641.23 26.874
  > svytotal(~enroll,rclus1g)
           total     SE
  enroll 3647280 463582
  > 
  > all.equal(as.vector(weights(rclus1g)/weights(rclus1r)),rep(1,183))
  [1] "Numeric: lengths (2745, 183) differ"
  > 
  > ## Do it for a design without replicate weights
  > dclus1r<-rake(dclus1, list(~stype,~sch.wide), list(pop.types, pop.schwide),
  +               control=list(epsilon=1e-10,maxit=30))
  > 
  > svymean(~api00, dclus1r)
          mean     SE
  api00 641.23 23.704
  > svytotal(~enroll, dclus1r)
           total     SE
  enroll 3647280 400603
  > 
  > dclus1g<-calibrate(dclus1, ~stype+sch.wide, poptotals,calfun="raking",tol=1e-10)
  > 
  > svymean(~api00,dclus1g)
          mean     SE
  api00 641.23 23.704
  > svytotal(~enroll,dclus1g)
           total     SE
  enroll 3647280 400603
  > 
  > all.equal(as.vector(weights(dclus1g)/weights(dclus1r)),rep(1,183))
  [1] TRUE
  > 
  > 
  > ## Example of raking with partial joint distributions
  > pop.table <- xtabs(~stype+sch.wide,apipop)
  > pop.imp<-data.frame(comp.imp=c("No","Yes"),Freq=c(1712,4482))
  > dclus1r2<-rake(dclus1, list(~stype+sch.wide, ~comp.imp),
  +                list(pop.table, pop.imp),
  +                control=list(epsilon=1e-10,maxit=30))
  Warning message:
  In rake(dclus1, list(~stype + sch.wide, ~comp.imp), list(pop.table,  :*** buffer overflow detected ***: terminated
  Aborted