sqlocpoly {surveyNG}R Documentation

Smoothing

Description

This function performs weighted density estimation and smoothing, using the binned local polynomial smoothers in the KernSmooth package.

Usage

sqlocpoly(formula, design, bandwidth, M = 401)

Arguments

formula One-sided formula for density estimation, two-sided for smoothing
design sqlsurvey object
bandwidth Smoothing bandwidth
M Number of grid points

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.

Value

An object of class svysmooth

See Also

sqlsurvey

Examples

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

dens <- sqlocpoly(~api00, sqclus1, bandwidth=50)
smooth <- sqlocpoly(api00~api99, sqclus1, bandwidth=50)

dens
plot(dens)
plot(smooth)

close(sqclus1)

[Package surveyNG version 0.3 Index]