svydbmean: Population Mean

Description Usage Arguments Author(s) See Also Examples

View source: R/svydbmean.R

Description

Computes population mean from survey data sets.

Usage

1
2
svydbmean(x, num, design, return.mean = F,
  lonely.psu = getOption("svydb.lonely.psu"), ...)

Arguments

x

Name indicating the variable.

num

TRUE or FALSE indicating whether x is numeric or categorical.

design

svydb.design object.

return.mean

TRUE to return only means, no standard errors.

Author(s)

Charco Hui

See Also

svydbdesign, svydbtotal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(nhane)
nh.dbsurv = svydbdesign(st = SDMVSTRA, wt = WTMEC2YR, id = SDMVPSU, data = nhane)
svydbmean(x = DirectChol, design = nh.dbsurv, num = T)
svydbmean(x = Race3, design = nh.dbsurv, num = F)
svydbmean(x = DirectChol, design = nh.dbsurv, num = T, return.mean = T)
coef(svydbmean(x = DirectChol, design = nh.dbsurv, num = T))
SE(svydbmean(x = DirectChol, design = nh.dbsurv, num = T))
# OR with a database connection
# library(MonetDBLite)
# library(DBI)
# library(dbplyr)
# con = dbConnect(MonetDBLite())
# dbWriteTable(con, "nhane", nhane)
# nhane.db = tbl(con, "nhane")
# nh.dbsurv = svydbdesign(st = SDMVSTRA, wt = WTMEC2YR, id = SDMVPSU, data = nhane.db)

chrk623/svydb documentation built on Oct. 6, 2019, 6:54 a.m.