svymean.sqlsurvey: Means and totals

Description Usage Arguments Value See Also Examples

Description

Horvitz-Thompson estimator of means and totals for a large survey. The functions computes cell proportions and counts for factor variables. For surveys with replicate weights (sqlrepsurvey) only, it is possible to use expressions involving mathematical functions, logical operations, %in%, and cut.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## S3 method for class 'sqlrepsurvey'
svymean(x, design, na.rm = TRUE, byvar = NULL, se = TRUE, 
    ...) 
## S3 method for class 'sqlrepsurvey'
svytotal(x, design, na.rm = TRUE, byvar = NULL, se = TRUE, 
    ...) 
## S3 method for class 'sqlsurvey'
svymean(x, design, na.rm = TRUE, byvar = NULL,
se = FALSE, keep.estfun = FALSE, ...)
## S3 method for class 'sqlsurvey'
svytotal(x, design, na.rm = TRUE, byvar = NULL,
se = FALSE, keep.estfun = FALSE, ...)

Arguments

x

model formula

design

sqlsurvey object

na.rm

Remove missing values (treat as domain)

byvar

Formula with grouping variables

se

Compute variance-covariance matrix?

keep.estfun

Keep the SQL table of estimating functions after the standard errors are computed.

...

For future expansion

Value

A data frame with a column for each variable and a row for each group, with the covariance matrix in the "var" attribute.

See Also

sqlmodelmatrix

Examples

1
2
3
4
5
## Not run: 
svytotal(~sex, acs, byvar=~st)
svymean(~wagp,subset(acs, wagp>0), byvar=~sex)

## End(Not run)

sqlsurvey documentation built on May 2, 2019, 4:53 p.m.