Learn R Programming

convey (version 1.0.1)

densfun: Estimate the derivative of the cdf function using kernel estimator

Description

computes the derivative of a function in a point using kernel estimation

Usage

densfun(formula, design, x, h = NULL, FUN = "F", na.rm = FALSE, ...)

Value

the value of the derivative at x

Arguments

formula

a formula specifying the income variable

design

a design object of class survey.design from the survey library.

x

the point where the derivative is calculated

h

value of the bandwidth based on the whole sample

FUN

if F estimates the derivative of the cdf function; if big_s estimates the derivative of total in the tails of the distribution

na.rm

Should cases with missing values be dropped?

...

future expansion

Author

Djalma Pessoa and Anthony Damico

Examples

Run this code
library(laeken)
data(eusilc) ; names( eusilc ) <- tolower( names( eusilc ) )
library(survey)
des_eusilc <- svydesign(ids = ~rb030, strata =~db040,  weights = ~rb050, data = eusilc)
des_eusilc <- convey_prep( des_eusilc )
densfun (~eqincome, design=des_eusilc, 10000, FUN="F" )
# linearized design using a variable with missings
densfun ( ~ py010n , design = des_eusilc, 10000, FUN="F" )
densfun ( ~ py010n , design = des_eusilc , 10000,FUN="F", na.rm = TRUE )

Run the code above in your browser using DataLab