Last updated on 2026-10-24 09:51:05 CEST.
| Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
|---|---|---|---|---|---|---|
| r-devel-linux-x86_64-debian-clang | 4.5 | 48.24 | 425.25 | 473.49 | NOTE | |
| r-devel-linux-x86_64-debian-gcc | 4.5 | 36.55 | 279.85 | 316.40 | ERROR | |
| r-devel-linux-x86_64-fedora-clang | 4.5 | 39.00 | 378.13 | 417.13 | NOTE | |
| r-devel-linux-x86_64-fedora-gcc | 4.5 | 38.00 | 287.14 | 325.14 | NOTE | |
| r-devel-windows-x86_64 | 4.5 | 59.00 | 552.00 | 611.00 | NOTE | |
| r-patched-linux-x86_64 | 4.5 | 54.18 | 402.26 | 456.44 | NOTE | |
| r-release-linux-x86_64 | 4.5 | 51.38 | 400.00 | 451.38 | NOTE | |
| r-release-macos-arm64 | 4.5 | 11.00 | 100.00 | 111.00 | OK | |
| r-release-macos-x86_64 | 4.5 | 33.00 | 424.00 | 457.00 | OK | |
| r-release-windows-x86_64 | 4.5 | 63.00 | 454.00 | 517.00 | NOTE | |
| r-oldrel-macos-arm64 | 4.5 | 10.00 | 107.00 | 117.00 | OK | |
| r-oldrel-macos-x86_64 | 4.5 | 38.00 | 682.00 | 720.00 | OK | |
| r-oldrel-windows-x86_64 | 4.5 | 74.00 | 580.00 | 654.00 | NOTE |
Version: 4.5
Check: R code for possible problems
Result: NOTE
svycoxph.svyrep.design: no visible binding for global variable
‘parallel’
Undefined global functions or variables:
parallel
Flavors: r-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-devel-windows-x86_64, r-patched-linux-x86_64, r-release-linux-x86_64, r-release-windows-x86_64, r-oldrel-windows-x86_64
Version: 4.5
Check: examples
Result: ERROR
Running examples in ‘survey-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: anova.svyglm
> ### Title: Model comparison for glms.
> ### Aliases: anova.svyglm AIC.svyglm BIC.svyglm extractAIC.svyglm
> ### extractAIC.svrepglm anova.svycoxph
> ### Keywords: survey regression
>
> ### ** Examples
>
> data(api)
> dclus2<-svydesign(id=~dnum+snum, weights=~pw, data=apiclus2)
>
> model0<-svyglm(I(sch.wide=="Yes")~ell+meals+mobility, design=dclus2, family=quasibinomial())
> model1<-svyglm(I(sch.wide=="Yes")~ell+meals+mobility+as.numeric(stype),
+ design=dclus2, family=quasibinomial())
> model2<-svyglm(I(sch.wide=="Yes")~ell+meals+mobility+stype, design=dclus2, family=quasibinomial())
>
> anova(model2)
Anova table: (Rao-Scott LRT)
svyglm(formula = I(sch.wide == "Yes") ~ ell, design = dclus2,
family = quasibinomial())
stats DEff df ddf p
ell 1.1259 0.76870 1.00000 38 0.236339
meals 4.8189 1.24181 1.00000 37 0.058326 .
mobility 0.3712 1.42335 1.00000 36 0.608418
stype 52.4054 2.43494 2.00000 34 0.001341 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> anova(model0,model2)
Working (Rao-Scott+F) LRT for stype
in svyglm(formula = I(sch.wide == "Yes") ~ ell + meals + mobility +
stype, design = dclus2, family = quasibinomial())
Working 2logLR = 21.52228 p= 0.0013407
(scale factors: 1.7 0.3 ); denominator df= 34
> anova(model1, model2)
Working (Rao-Scott+F) LRT for stype - as.numeric(stype)
in svyglm(formula = I(sch.wide == "Yes") ~ ell + meals + mobility +
stype, design = dclus2, family = quasibinomial())
Working 2logLR = 25.10744 p= 1.816e-05
df=1; denominator df= 34
>
> anova(model1, model2, method="Wald")
Wald test for stype - as.numeric(stype)
in svyglm(formula = I(sch.wide == "Yes") ~ ell + meals + mobility +
stype, design = dclus2, family = quasibinomial())
F = 17.73552 on 1 and 34 df: p= 0.00017598
>
> AIC(model0,model1, model2)
eff.p AIC deltabar
[1,] 3.538287 142.11041 1.179429
[2,] 6.248895 119.31208 1.562224
[3,] 7.202561 97.03351 1.440512
> BIC(model0, model2,maximal=model2)
p BIC neff
[1,] 4 120.8183 72.43313
[2,] 6 111.6461 NaN
>
> ## AIC for linear model is different because it considers the variance
> ## parameter
>
> model0<-svyglm(api00~ell+meals+mobility, design=dclus2)
> model1<-svyglm(api00~ell+meals+mobility+as.numeric(stype),
+ design=dclus2)
> model2<-svyglm(api00~ell+meals+mobility+stype, design=dclus2)
> modelnull<-svyglm(api00~1, design=dclus2)
>
> AIC(model0, model1, model2)
eff.p AIC deltabar
[1,] 8.471076 1511.490 2.117769
[2,] 8.930904 1493.666 1.786181
[3,] 9.161874 1458.431 1.526979
>
> AIC(model0, model1, model2,modelnull, null_has_intercept=FALSE)
eff.p AIC deltabar
[1,] 14.810371 1524.169 2.962074
[2,] 15.317731 1506.439 2.552955
[3,] 14.119302 1468.346 2.017043
[4,] 8.973937 1614.039 4.486968
>
> ## from ?twophase
> data(nwtco)
> dcchs<-twophase(id=list(~seqno,~seqno), strata=list(NULL,~rel),
+ subset=~I(in.subcohort | rel), data=nwtco)
> a<-svycoxph(Surv(edrel,rel)~factor(stage)+factor(histol)+I(age/12), design=dcchs)
Error in a$specials[[i]] : subscript out of bounds
Calls: svycoxph ... model.matrix -> model.matrix.coxph -> delete.response -> off
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 4.5
Check: tests
Result: ERROR
Running ‘3stage2phase.R’ [2s/3s]
Running ‘DBIcheck.R’ [2s/3s]
Running ‘anova-svycoxph.R’ [2s/2s]
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’ [2s/3s]
Running ‘bycovmat.R’ [2s/2s]
Running ‘caleg.R’ [3s/4s]
Running ‘check.R’ [2s/2s]
Comparing ‘check.Rout’ to ‘check.Rout.save’ ... OK
Running ‘confintrep.R’ [2s/2s]
Running ‘contrast-replicates.R’ [2s/2s]
Running ‘coxph-termtest.R’ [2s/2s]
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’ [4s/5s]
Running ‘multistage-rcpp.R’ [2s/3s]
Running ‘multistage.R’ [2s/2s]
Running ‘na_action.R’ [2s/2s]
Running ‘na_weights.R’ [2s/2s]
Running ‘newquantile.R’ [2s/2s]
Running ‘nwts-cch.R’ [3s/3s]
Running ‘nwts.R’ [4s/5s]
Comparing ‘nwts.Rout’ to ‘nwts.Rout.save’ ... OK
Running ‘poisson.R’ [2s/2s]
Running ‘pps.R’ [2s/3s]
Running ‘predict-NA.R’ [2s/3s]
Running ‘qrule-swiss.R’ [2s/2s]
Running ‘quantile.R’ [3s/3s]
Comparing ‘quantile.Rout’ to ‘quantile.Rout.save’ ... OK
Running ‘quantiles-chile.R’ [2s/2s]
Running ‘rakecheck.R’ [2s/3s]
Comparing ‘rakecheck.Rout’ to ‘rakecheck.Rout.save’ ... OK
Running ‘raowuboot.R’ [2s/3s]
Comparing ‘raowuboot.Rout’ to ‘raowuboot.Rout.save’ ... OK
Running ‘regTermTest-missing.R’ [2s/3s]
Running ‘regpredict.R’ [2s/3s]
Comparing ‘regpredict.Rout’ to ‘regpredict.Rout.save’ ... OK
Running ‘rss_scores.R’ [2s/2s]
Running ‘scoping.R’ [2s/2s]
Running ‘survcurve.R’ [2s/2s]
Running ‘svyby-strings.R’ [2s/2s]
Running ‘svyby_bug.R’ [2s/2s]
Running ‘svyby_se.R’ [2s/2s]
Running ‘svycontrast.R’ [2s/3s]
Running ‘svyivreg-var.R’ [2s/2s]
Running ‘svyivreg.R’ [2s/2s]
Running ‘svyolr-rake-subset.R’ [2s/2s]
Running ‘svyolr.R’ [2s/3s]
Running ‘testthat.R’ [5s/6s]
Running ‘toy_example_for_postStratify.R’ [2s/3s]
Running ‘twophase.R’ [3s/3s]
Running the tests in ‘tests/anova-svycoxph.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
> example(svycoxph, ask=FALSE)
svycxp> ## Somewhat unrealistic example of nonresponse bias.
svycxp> data(pbc, package="survival")
svycxp> pbc$randomized<-with(pbc, !is.na(trt) & trt>0)
svycxp> biasmodel<-glm(randomized~age*edema,data=pbc,family=binomial)
svycxp> pbc$randprob<-fitted(biasmodel)
svycxp> if (is.null(pbc$albumin)) pbc$albumin<-pbc$alb ##pre2.9.0
svycxp> dpbc<-svydesign(id=~1, prob=~randprob, strata=~edema, data=subset(pbc,randomized))
svycxp> rpbc<-as.svrepdesign(dpbc)
svycxp> (model<-svycoxph(Surv(time,status>0)~log(bili)+protime+albumin,design=dpbc))
Error in a$specials[[i]] : subscript out of bounds
Calls: example ... model.matrix -> model.matrix.coxph -> delete.response -> off
Execution halted
Running the tests in ‘tests/coxph-termtest.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
> library(survival)
> set.seed(2021-6-25)
> test1 <- list(time=c(4,3,1,1,2,2,3),
+ status=c(1,1,1,0,1,1,0),
+ x1=as.factor(rbinom(7, 2, 0.5)),
+ x=c(0,2,1,1,1,0,0))
> # Fit a stratified model
> mod_c <- coxph(Surv(time, status) ~ x1 + x, test1)
> mod_d <- coxph(Surv(time, status) ~ x + x1, test1)
> stopifnot(all.equal(regTermTest(mod_c, ~x1, df = Inf)[c("chisq","df","test.terms","p")],
+ regTermTest(mod_d, ~x1, df = Inf)[c("chisq","df","test.terms","p")]))
Error in (function (cond) :
error in evaluating the argument 'target' in selecting a method for function 'all.equal': subscript out of bounds
Calls: stopifnot ... model.matrix.coxph -> delete.response -> off -> <Anonymous>
Execution halted
Running the tests in ‘tests/logranktest.R’ failed.
Complete output:
> ## StackOverflow 63333282
>
> 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
> D = data.frame(unique_id = 1:135,
+
+ weights = rep(1,135),
+
+ event_time = c(0.53512437, 1.35655869, 2.00414189, 2.37276648, 3.20343526, 0.96618494, 2.57894309, 0.94575080, 1.25347833, 1.44416450, 5.04038200, 7.80587169 ,
+
+ 6.53631154, 6.31914568, 7.00146597, 9.67616088, 7.94212358, 9.70693890, 10.67575835, 10.06764688, 12.29175616, 13.60092871, 13.12508566, 14.66417522,
+
+ 15.35250691, 0.93368707, 0.19087611, 3.15533767, 4.40821633, 17.54334957, 17.95177642, 15.50903946, 16.48376185, 20.87956697, 21.24571398, 22.34297263,
+
+ 23.36042629, 21.01760215, 23.84785038, 26.06105822, 4.16866350, 1.96922485, 0.66199008, 6.76987830, 1.55617685, 0.19095871, 3.13291784, 5.43159409,
+
+ 9.55805671, 4.31437322, 0.78259860, 5.26415156, 3.45095686, 1.69128712, 8.41942426, 3.33748695, 6.08516173, 2.72897404, 0.22789783, 0.86348009,
+
+ 2.35707587, 2.97477615, 12.33273800, 0.58532123, 0.14586238, 10.67948547, 4.07655972, 3.94405136, 0.37226898, 1.42558725, 1.47680658, 4.22506540,
+
+ 1.56703478, 8.37484756, 12.54015087, 1.80994787, 3.66453633, 1.02834532, 1.99065652, 1.23577436, 16.21981618, 14.35039798, 4.15321606, 2.79740679,
+
+ 0.35538726, 7.46823358, 1.66329088, 7.46525382, 2.62734831, 3.19057957, 0.33317193, 0.09122886, 9.14616245, 2.48542578, 2.37569263, 5.48499630,
+
+ 2.22749399, 2.64816296, 0.97101545, 1.42468625, 1.27668904, 0.03692447, 1.98783210, 5.47692729, 3.88316178, 0.32921277, 1.77225345, 9.33268901,
+
+ 2.44517775, 1.49813702, 2.56059172, 3.43194832, 1.22955630, 3.56263947, 9.07060099, 3.58312362, 2.22755370, 4.24783776, 3.46364804, 1.61671354,
+
+ 11.10973565, 7.18764270, 1.80400046, 6.39833474, 6.72825192, 6.46063344, 5.76855531, 5.27157807, 4.66154734, 3.50019718, 2.27156678, 3.28531594,
+
+ 2.35699896, 2.94956000, 8.85381736),
+
+ event_flag = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1,
+
+ 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1,
+
+ 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0),
+
+ group = c(rep("group1", 40), rep("group2", 95)))
>
>
>
> svykm_formula = as.formula("Surv(event_time, event_flag) ~ group")
>
> svy_design = svydesign( ids = ~unique_id , weights = ~weights, data = D )
>
> a<-svylogrank(formula = svykm_formula, design = svy_design)
Error in a$specials[[i]] : subscript out of bounds
Calls: svylogrank ... model.matrix -> model.matrix.coxph -> delete.response -> off
Execution halted
Running the tests in ‘tests/nwts-cch.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
> library(survival)
> data(nwtco)
>
> ntwco<-subset(nwtco, !is.na(edrel))
>
> load("nwtco-subcohort.rda")
> nwtco$subcohort<-subcohort
>
> d_BorganII <- twophase(id=list(~seqno,~seqno),
+ strata=list(NULL,~interaction(instit,rel)),
+ data=nwtco, subset=~I(rel |subcohort))
>
> ##Coefficient results same as Splus with code from
> ## http://faculty.washington.edu/norm/software.html
> ## SE slightly larger due to using sandwich variance.
>
> svycoxph(Surv(edrel, rel)~factor(stage)+factor(histol)+I(age/12), design=d_BorganII)
Error in a$specials[[i]] : subscript out of bounds
Calls: svycoxph ... model.matrix -> model.matrix.coxph -> delete.response -> off
Execution halted
Running the tests in ‘tests/scoping.R’ failed.
Complete output:
>
> ## regression test for testing regression
>
> 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)
>
> dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)
>
>
> f<-function(){
+ form<-acs.46~stype
+ svyglm(formula=form, design = dstrat)
+ }
>
> g<-function(form){
+ svyglm(formula=form, design = dstrat)
+ }
> f()
Stratified Independent Sampling design
svydesign(id = ~1, strata = ~stype, weights = ~pw, data = apistrat,
fpc = ~fpc)
Call: svyglm(formula = form, design = dstrat)
Coefficients:
(Intercept) stypeH stypeM
28.7449 0.7551 0.4022
Degrees of Freedom: 133 Total (i.e. Null); 129 Residual
(66 observations deleted due to missingness)
Null Deviance: 1838
Residual Deviance: 1835 AIC: NA
> g(acs.46~stype)
Stratified Independent Sampling design
svydesign(id = ~1, strata = ~stype, weights = ~pw, data = apistrat,
fpc = ~fpc)
Call: svyglm(formula = form, design = dstrat)
Coefficients:
(Intercept) stypeH stypeM
28.7449 0.7551 0.4022
Degrees of Freedom: 133 Total (i.e. Null); 129 Residual
(66 observations deleted due to missingness)
Null Deviance: 1838
Residual Deviance: 1835 AIC: NA
>
> f<-function(){
+ form<-Surv(acs.46)~stype
+ svycoxph(formula=form, design = dstrat)
+ }
>
> g<-function(form){
+ svycoxph(formula=form, design = dstrat)
+ }
>
> f()
Error in a$specials[[i]] : subscript out of bounds
Calls: f ... model.matrix -> model.matrix.coxph -> delete.response -> off
Execution halted
Running the tests in ‘tests/survcurve.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
> library(survival)
>
> pbc2<-rbind(pbc,pbc)
> pbc2$id<-rep(1:418,2)
>
> dpbc1<-svydesign(id=~1, data=pbc)
Warning message:
In svydesign.default(id = ~1, data = pbc) :
No weights or probabilities supplied, assuming equal probability
> dpbc2<-svydesign(id=~id, data=pbc2)
Warning message:
In svydesign.default(id = ~id, data = pbc2) :
No weights or probabilities supplied, assuming equal probability
>
> s1<-svykm(Surv(time,status>0)~1, subset(dpbc1, bili>6), se=TRUE)
> s2<-svykm(Surv(time,status>0)~1, subset(dpbc2, bili>6), se=TRUE)
>
> (c1<-confint(s1,(1:5)*365))
0.025 0.975
365 0.6446215 0.8594153
730 0.5410938 0.7766848
1095 0.2683127 0.5103356
1460 0.1444731 0.3722001
1825 0.1009672 0.3204713
> (c2<-confint(s2,(1:5)*365))
0.025 0.975
365 0.6446215 0.8594153
730 0.5410938 0.7766848
1095 0.2683127 0.5103356
1460 0.1444731 0.3722001
1825 0.1009672 0.3204713
> all.equal(c1, c2)
[1] TRUE
>
> m1<-svycoxph(Surv(time,status>0)~log(bili), design=dpbc1)
Error in a$specials[[i]] : subscript out of bounds
Calls: svycoxph ... model.matrix -> model.matrix.coxph -> delete.response -> off
Execution halted
Running the tests in ‘tests/twophase.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
>
> ## two-phase simple random sampling.
> data(pbc, package="survival")
> pbc$id<-1:nrow(pbc)
> pbc$randomized<-with(pbc, !is.na(trt) & trt>-9)
> (d2pbc<-twophase(id=list(~id,~id), data=pbc, subset=~I(!randomized)))
Two-phase sparse-matrix design:
twophase(id = list(~id, ~id), data = pbc, subset = ~I(!randomized))
Phase 1:
Independent Sampling design (with replacement)
svydesign(ids = ~id)
Phase 2:
Independent Sampling design
svydesign(ids = ~id, fpc = `*phase1*`)
> m<-svymean(~bili, d2pbc)
> all.equal(as.vector(coef(m)),with(pbc, mean(bili[!randomized])))
[1] TRUE
> all.equal(as.vector(SE(m)),
+ with(pbc, sd(bili[!randomized])/sqrt(sum(!randomized))),
+ tolerance=0.002)
[1] TRUE
>
> ## two-stage sampling as two-phase
> data(mu284)
> ii<-with(mu284, c(1:15, rep(1:5,n2[1:5]-3)))
> mu284.1<-mu284[ii,]
> mu284.1$id<-1:nrow(mu284.1)
> mu284.1$sub<-rep(c(TRUE,FALSE),c(15,34-15))
> dmu284<-svydesign(id=~id1+id2,fpc=~n1+n2, data=mu284)
> ## first phase cluster sample, second phase stratified within cluster
> (d2mu284<-twophase(id=list(~id1,~id),strata=list(NULL,~id1),
+ fpc=list(~n1,NULL),data=mu284.1,subset=~sub,method="approx"))
Two-phase design: twophase(id = list(~id1, ~id), strata = list(NULL, ~id1), fpc = list(~n1,
NULL), data = mu284.1, subset = ~sub, method = "approx")
Phase 1:
1 - level Cluster Sampling design
With (5) clusters.
svydesign(ids = ~id1, fpc = ~n1)
Phase 2:
Stratified Independent Sampling design
svydesign(ids = ~id, strata = ~id1, fpc = `*phase1*`)
> (d22mu284<-twophase(id=list(~id1,~id),strata=list(NULL,~id1),
+ fpc=list(~n1,NULL),data=mu284.1,subset=~sub,method="full"))
Two-phase sparse-matrix design:
twophase(id = list(~id1, ~id), strata = list(NULL, ~id1), fpc = list(~n1,
NULL), data = mu284.1, subset = ~sub, method = "full")
Phase 1:
1 - level Cluster Sampling design
With (5) clusters.
svydesign(ids = ~id1, fpc = ~n1)
Phase 2:
Stratified Independent Sampling design
svydesign(ids = ~id, strata = ~id1, fpc = `*phase1*`)
> summary(d2mu284)
Two-phase design: twophase(id = list(~id1, ~id), strata = list(NULL, ~id1), fpc = list(~n1,
NULL), data = mu284.1, subset = ~sub, method = "approx")
Phase 1:
1 - level Cluster Sampling design
With (5) clusters.
svydesign(ids = ~id1, fpc = ~n1)
Probabilities:
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.1 0.1 0.1 0.1 0.1 0.1
Population size (PSUs): 50
Phase 2:
Stratified Independent Sampling design
svydesign(ids = ~id, strata = ~id1, fpc = `*phase1*`)
Probabilities:
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.3333 0.3750 0.4286 0.4674 0.6000 0.6000
Stratum Sizes:
19 31 45 47 50
obs 3 3 3 3 3
design.PSU 3 3 3 3 3
actual.PSU 3 3 3 3 3
Population stratum sizes (PSUs):
19 31 45 47 50
5 7 8 5 9
Data variables:
[1] "id1" "n1" "id2" "y1" "n2" "id" "sub"
> t1<-svytotal(~y1, dmu284)
> t2<-svytotal(~y1, d2mu284)
> t22<-svytotal(~y1,d22mu284)
> m1<-svymean(~y1, dmu284)
> m2<-svymean(~y1, d2mu284)
> m22<-svymean(~y1, d22mu284)
> all.equal(coef(t1),coef(t2))
[1] TRUE
> all.equal(coef(t1),coef(t22))
[1] TRUE
> all.equal(coef(m1),coef(m2))
[1] TRUE
> all.equal(coef(m1),coef(m22))
[1] TRUE
> all.equal(as.vector(SE(m1)),as.vector(SE(m2)))
[1] TRUE
> all.equal(as.vector(SE(m1)),as.vector(SE(m22)))
[1] TRUE
> all.equal(as.vector(SE(t1)),as.vector(SE(t2)))
[1] TRUE
> all.equal(as.vector(SE(t1)),as.vector(SE(t22)))
[1] TRUE
>
> ## case-cohort design
> ##this example requires R 2.3.1 or later for cch and data.
> library("survival")
> data(nwtco, package="survival")
> ## unstratified, equivalent to Lin & Ying (1993)
> print(dcchs<-twophase(id=list(~seqno,~seqno), strata=list(NULL,~rel),
+ subset=~I(in.subcohort | rel), data=nwtco))
Two-phase sparse-matrix design:
twophase(id = list(~seqno, ~seqno), strata = list(NULL, ~rel),
subset = ~I(in.subcohort | rel), data = nwtco)
Phase 1:
Independent Sampling design (with replacement)
svydesign(ids = ~seqno)
Phase 2:
Stratified Independent Sampling design
svydesign(ids = ~seqno, strata = ~rel, fpc = `*phase1*`)
> cch1<-svycoxph(Surv(edrel,rel)~factor(stage)+factor(histol)+I(age/12),
+ design=dcchs)
Error in a$specials[[i]] : subscript out of bounds
Calls: svycoxph ... model.matrix -> model.matrix.coxph -> delete.response -> off
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 4.5
Check: re-building of vignette outputs
Result: ERROR
Error(s) in re-building vignettes:
...
--- re-building ‘survey-sae.html.asis’ using asis
--- finished re-building ‘survey-sae.html.asis’
--- re-building ‘multiphase.Rmd’ using rmarkdown
[WARNING] Deprecated: --mathjax. Use --math-method=mathjax[:URL] instead.
--- finished re-building ‘multiphase.Rmd’
--- re-building ‘domain.Rnw’ using Sweave
Loading required package: grid
Loading required package: Matrix
Loading required package: survival
Attaching package: ‘survey’
The following object is masked from ‘package:graphics’:
dotchart
--- finished re-building ‘domain.Rnw’
--- re-building ‘epi.Rnw’ using Sweave
Loading required package: grid
Loading required package: Matrix
Loading required package: survival
Attaching package: ‘survey’
The following object is masked from ‘package:graphics’:
dotchart
Warning in eval(family$initialize) :
non-integer #successes in a binomial glm!
Warning in eval(family$initialize) :
non-integer #successes in a binomial glm!
Warning in eval(family$initialize) :
non-integer #successes in a binomial glm!
Error: processing vignette 'epi.Rnw' failed with diagnostics:
chunk 7
Error in a$specials[[i]] : subscript out of bounds
--- failed re-building ‘epi.Rnw’
--- re-building ‘pps.Rnw’ using Sweave
Loading required package: grid
Loading required package: Matrix
Loading required package: survival
Attaching package: ‘survey’
The following object is masked from ‘package:graphics’:
dotchart
--- finished re-building ‘pps.Rnw’
--- re-building ‘precalibrated.Rnw’ using Sweave
Loading required package: grid
Loading required package: Matrix
Loading required package: survival
Attaching package: ‘survey’
The following object is masked from ‘package:graphics’:
dotchart
--- finished re-building ‘precalibrated.Rnw’
--- re-building ‘qrule.Rnw’ using Sweave
--- finished re-building ‘qrule.Rnw’
--- re-building ‘survey.Rnw’ using Sweave
Loading required package: grid
Loading required package: Matrix
Loading required package: survival
Attaching package: ‘survey’
The following object is masked from ‘package:graphics’:
dotchart
--- finished re-building ‘survey.Rnw’
SUMMARY: processing the following file failed:
‘epi.Rnw’
Error: Vignette re-building failed.
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc