ftable.svystat.RdReformat the output of survey computations to a table.
Output of functions such as svymean,svrepmean, svyby
List of vectors of strings giving dimension names for the resulting table (see examples)
Arguments for future expansion
An object of class "ftable"
data(api)
dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
a<-svymean(~interaction(stype,comp.imp), design=dclus1)
b<-ftable(a, rownames=list(stype=c("E","H","M"),comp.imp=c("No","Yes")))
b
#> stype E H M
#> comp.imp
#> No mean 0.17486339 0.03825137 0.06010929
#> SE 0.02599552 0.01607602 0.02457177
#> Yes mean 0.61202186 0.03825137 0.07650273
#> SE 0.04167572 0.01605469 0.02167084
a<-svymean(~interaction(stype,comp.imp), design=dclus1, deff=TRUE)
b<-ftable(a, rownames=list(stype=c("E","H","M"),comp.imp=c("No","Yes")))
round(100*b,1)
#> stype E H M
#> comp.imp
#> No mean 17.5 3.8 6.0
#> SE 2.6 1.6 2.5
#> Deff 87.8 131.7 200.4
#> Yes mean 61.2 3.8 7.7
#> SE 4.2 1.6 2.2
#> Deff 137.2 131.4 124.7
rclus1<-as.svrepdesign(dclus1)
a<-svytotal(~interaction(stype,comp.imp), design=rclus1)
b<-ftable(a, rownames=list(stype=c("E","H","M"),comp.imp=c("No","Yes")))
b
#> stype E H M
#> comp.imp
#> No total 1083.10388 236.92897 372.31696
#> SE 373.15133 108.21477 114.69172
#> Yes total 3790.86359 236.92897 473.85795
#> SE 994.30863 83.05377 166.10754
round(b)
#> stype E H M
#> comp.imp
#> No total 1083 237 372
#> SE 373 108 115
#> Yes total 3791 237 474
#> SE 994 83 166
a<-svyby(~api99 + api00, ~stype + sch.wide, rclus1, svymean, keep.var=TRUE)
ftable(a)
#> sch.wide No Yes
#> api99 api00 api99 api00
#> stype
#> E svymean 601.66667 596.33333 608.34848 653.64394
#> SE 70.04669 64.50553 23.67277 22.37296
#> H svymean 662.00000 659.33333 577.63636 607.45455
#> SE 40.92204 37.80385 57.38815 53.97142
#> M svymean 611.37500 606.37500 607.29412 643.23529
#> SE 48.19716 48.27853 49.49574 49.34813
print(ftable(a),digits=2)
#> sch.wide No Yes
#> api99 api00 api99 api00
#> stype
#> E svymean 602 596 608 654
#> SE 70 65 24 22
#> H svymean 662 659 578 607
#> SE 41 38 57 54
#> M svymean 611 606 607 643
#> SE 48 48 49 49
b<-svyby(~api99 + api00, ~stype + sch.wide, rclus1, svymean, keep.var=TRUE, deff=TRUE)
print(ftable(b),digits=2)
#> sch.wide No Yes
#> api99 api00 api99 api00
#> stype
#> E svymean 601.7 596.3 608.3 653.6
#> SE 70.0 64.5 23.7 22.4
#> DEff 6.3 6.6 5.6 6.0
#> H svymean 662.0 659.3 577.6 607.5
#> SE 40.9 37.8 57.4 54.0
#> DEff 1.4 1.4 3.0 3.0
#> M svymean 611.4 606.4 607.3 643.2
#> SE 48.2 48.3 49.5 49.3
#> DEff 1.8 1.8 3.1 3.4
d<-svyby(~api99 + api00, ~stype + sch.wide, rclus1, svymean, keep.var=TRUE, vartype=c("se","cvpct"))
round(ftable(d),1)
#> sch.wide No Yes
#> api99 api00 api99 api00
#> stype
#> E svymean 601.7 596.3 608.3 653.6
#> SE 70.0 64.5 23.7 22.4
#> cv% 11.6 10.8 3.9 3.4
#> H svymean 662.0 659.3 577.6 607.5
#> SE 40.9 37.8 57.4 54.0
#> cv% 6.2 5.7 9.9 8.9
#> M svymean 611.4 606.4 607.3 643.2
#> SE 48.2 48.3 49.5 49.3
#> cv% 7.9 8.0 8.2 7.7