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

View source: R/all_funs.R

densfunR Documentation

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, ...)

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

Value

the value of the derivative at x

Author(s)

Djalma Pessoa and Anthony Damico

Examples

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 )


convey documentation built on Oct. 16, 2024, 5:10 p.m.