sqlocpoly: Smoothing and density estimation for large surveys

Description Usage Arguments Details Value See Also Examples

Description

Estimates smooth curves and densities using the binned local polynomial smoothers in the KernSmooth package.

Usage

1
2
3
4
## S3 method for class 'sqlsurvey'
svysmooth(formula, design, bandwidth=NULL, M = 101,sample.bandwidth=NULL,...)
## S3 method for class 'sqlrepsurvey'
svysmooth(formula, design, bandwidth=NULL, M = 101,sample.bandwidth=NULL,...)

Arguments

formula

two-sided formula (one-sided for density estimation in svysmooth)

design

sqlsurvey orsqlrepsurvey object

bandwidth

Smoothing bandwidth. Either this or sample.bandwidth must be non-null

M

Number of grid points for binned smoother

sample.bandwidth

either NULL or the size of a sample to take for estimating bandwidth

...

dots

Details

The binning is performed in SQL, so for large data sets the computation time is roughly linear in M and in the number of observations. M should be a few times larger than range(x)/bandwidth, but can often be reduced from the default value.

If sample.bandwidth is not NULL, a simple random sample of the specified size is taken from the data and the optimal bandwidth is computed using the functions in the 'KernSmooth' package and then rescaled to the full sample size.

Quantile smoothing is not currently available.

Value

An object of class svysmooth, with plot and lines methods

See Also

sqlsurvey,sqlrepsurvey,svysmooth

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
dens <-svysmooth(~bpxdar, sqhanes, bandwidth=50)
smooth <- svysmooth(bpxsar~bpxdar,subset(sqhanes,bpxdar>40), sample.bandwidth=5000)

dens
plot(dens)
plot(smooth)


## End(Not run)

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