svystat
Multiply the values of survey statistics by a specified vector elementwise, adjusting the variance.
# S3 method for svystat
*(x, y)
a [svystat][survey::svymean]
object with the updated statistics and variance-covariance matrix.
an object of class [svystat][survey::svymean]
.
a numeric vector equal in length to x
; shorter vectors will be recycled.
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