bw.dist.binned: Plug-in bandwidth selector for kernel distribution estimation...

Description Usage Arguments Value References Examples

Description

Plug-in bandwidth selector for kernel distribution estimation and binned data.

Usage

1
2
3
bw.dist.binned(n, y, w, ni, gplugin, type = "N", confband = F,
  B = 1000, alpha = 0.05, plot = TRUE, print = TRUE, model,
  parallel = FALSE, pars = new.env())

Arguments

n

Positive integer. Size of the complete sample.

y

Vector. Observed values. They define the extremes of the sequence of intervals in which data is binned.

w

Vector. Proportion of observations within each interval.

ni

Vector. Number of observations within each interval.

gplugin

Positive real number. Pilot bandwidth. If missing, rule-of-thumb bandwidth is considered.

type

Character. If type = "N", normality is assumed at the last step when calculating the plug-in bandwidth. If type = "A", parameter at last step is estimated nonparametrically using gplugin as bandwidth. Otherwise, the unknown parameter is estimated fitting a normal mixture. Defaults to type = "N".

confband

Logical. If TRUE, bootstrap confidence bands for the distribution are constructed. Defaults to FALSE.

B

Number of bootstrap resamples. Defaults to 1000.

alpha

Significance level for the bootstrap confidence bands. Defaults to 0.05.

plot

Logical. If TRUE, results are plotted. Defaults to TRUE.

print

Logical. If TRUE, script current status is printed. Defaults to TRUE.

model

Character. Name of the parametric family of distributions to be fitted for the grouped sample. Parameters are estimated by maximum likelihood.

parallel

Logical. If TRUE, confidence bands are estimated using parallel computing with sockets.

pars

Environment. Needed for the well functioning of the script. DO NOT modify this argument.

Value

A list with components

h

Plug-in bandwidth.

Fh

Function. Kernel distribution estimator with bandwidth h.

confband

(Optional) Bootstrap confidence bands for the distribution function.

References

\insertRef

TesisMiguel2015binnednp

\insertRef

Phalaris2016binnednp

Examples

1
2
3
4
5
6
7
set.seed(1)
n <- 200 #complete sample size
k <- 30 #number of intervals
x <- rnorm(n,6,1) #complete sample
y <- seq(min(x)-0.2,max(x)+0.2,len=k+1) #intervals
w <- c(sapply(2:k,function(i)sum( x<y[i]&x>=y[i-1] )), sum(x<=y[k+1]&x>=y[k]) )/n #proportions
bw.dist.binned(n,y,w,plot=FALSE)

binnednp documentation built on June 8, 2019, 1:02 a.m.