library(survey)
data(api)
# From example(svymean):
dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
(m1 <- svymean(~api99, dclus1))
(v1 <- vcov(m1))
# Scale the suvery stat object by a factor of two:
(m2 <- m1 * 2)
(v2 <- vcov(m2))
# \dontshow{
stopifnot(isTRUE(all.equal(as.vector(m2), as.vector(m1)*2, check.attributes=FALSE)))
stopifnot(isTRUE(all.equal(v2, v1*4)))
# }
Run the code above in your browser using DataLab