svydblm: Regression

Description Usage Arguments Author(s) See Also Examples

View source: R/svydblm.R

Description

Linear models for survey data sets.

Usage

1
svydblm(formula, design)

Arguments

formula

Model formula.

design

svydb.design object.

Author(s)

Charco Hui

See Also

svydbdesign

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(nhane)
nh.dbsurv = svydbdesign(st = SDMVSTRA, wt = WTMEC2YR, id = SDMVPSU, data = nhane)
svydblm(DirectChol ~ Age + BMI + factor(Gender), design = nh.dbsurv)
svydblm(DirectChol ~ Age + BMI, design = nh.dbsurv$subset(Race3 == 3))
coef(svydblm(DirectChol ~ Age + BMI, design = nh.dbsurv))
SE(svydblm(DirectChol ~ Age + BMI, design = nh.dbsurv))
vcov(svydblm(DirectChol ~ Age + BMI, design = nh.dbsurv))
head(residuals(svydblm(DirectChol ~ Age + BMI, design = nh.dbsurv)))
summary(svydblm(DirectChol ~ Age + BMI, design = nh.dbsurv))
predict(svydblm(DirectChol ~ Age + BMI, design = nh.dbsurv),
    newdata = data.frame(Age = 1:3, BMI = 4:6))
# 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.