svymean.sqlsurvey {surveyNG}R Documentation

Means and totals

Description

Horvitz-Thompson estimator of means and totals for a database-backed survey object. Computes cell proportions and counts for factor variables.

Usage

## S3 method for class 'sqlsurvey':
svymean(x, design, na.rm = FALSE, byvar = NULL,
se = FALSE, keep.estfun = FALSE, ...)
## S3 method for class 'sqlsurvey':
svytotal(x, design, na.rm = FALSE, 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

sqclus1<-sqlsurvey(id="dnum", fpc="fpc", weights="pw", strata="fpc",
   data=system.file("apiclus1.db",package="surveyNG"),
   table.name="clus1", key="snum")

sqclus1
svymean(~api99+stype, design=sqclus1)
svytotal(~enroll+stype, design=subset(sqclus1, api99 > 500))
close(sqclus1)


[Package surveyNG version 0.3 Index]